Forum
User profile updates
I have a problem in my implementation, gonna try to explain here. Maybe someone can help me.
Created a form
<perch:form id="profile" method="post" app="perch_members" >
<perch:success show-form="true">
<div id="uanotice" class="col-sm-6 col-sm-offset-3 s5paddingform text-center">
<p>Your details have been updated.</p>
</div>
</perch:success>
<perch:input type="text" placeholder="First Name *" class="form-control" id="first_name" required="true" label="First name"/>
<perch:error for="first_name" type="required" >First Name *</perch:error>
</div>
<div class="col-sm-3 s5paddingform">
<perch:input type="text" class="form-control" placeholder="Last Name *" id="last_name" required="true" label="Last name" />
<perch:error for="last_name" type="required" >Last Name *</perch:error>
<div class="row s5paddingform">
<div class="col-sm-6 col-sm-offset-3 s5btnpaddingform">
<perch:input type="submit" name="submit_profile" class="btn btn-base btn-submit" value="UPDATE ACCOUNT" />
<perch:input type="hidden" id="token" />
</div>
</div></perch:form>
When I click submit I get the message "Your details have been updated." But from this point if I change something else and click submit nothing happens, no message and data is not updated.
Note: There is no indication of javascript error in the page in all of this process, using perch debug also does not display any error
How can I have the profile updated again and again after the first post? Seems there is a problem in my code?
Thanks
What does the debug output at the point where it doesn't work?
Hi Drew,
Just as an extra information I have tested the example which comes with Perch in the Members zip file, it has same behavior (html in the bottom of this reply).
The default of the example doesn't have the show-form in the perch:sucess so it hides the form and user cannot change it again until refresh the page to see the form.
But in the example if we change to <perch:success show-form="true"> and after the first successful change with the success message if we try to change again nothing happens the page just reloads without changing the data.
Follows my debug:
1 First page load
2 First changes post got "Your details have been updated." this first post works pretty well
3 Second changes post got no changes after post
Clean test from Perch Members example, just added show-form="true" has same behavior, does not change data after the first change ahead
Ok, I'll see if I can reproduce it.
thanks for the help still no success here
No success here either. Is there anything else you can tell me?
Seems the form can be submitted only once, even the example \perch\addons\apps\perch_members\profile.html has the same behaviour when we set perch:success show-form="true".
We have implemented in another way.
Thanks
I ran into the behaviour described today.
It's because when a member profile is updated, the session data is refreshed and the new member session token doesn't match the form hidden field
<perch:input type="hidden" id="token" />
.As a workaround, I grabbed the token at the top of my page with
PerchSystem::set_var('token', perch_member_get('token'));
and replaced the hidden field in the template with<input id="token" name="token" value="<perch:members id="token" />" type="hidden">
.Seems to work with no problems.