Hi,
I use a checkbox as custom field in Login.Register snippet. If checbox has checked="checked" attribute Login.Register recognize it and the custom field value appears in user profile (name:mailinglist - value:on).
My problem is to handle this checkbox in the Login.UpdateProfile snippet. Despite there is no checked="checked" attribute Login.UpdateProfile doesn’t remove the custom field.
Do you have any idea how could I handle this checkbox in Login.UpdateProfile snippet?
thanks.
Put a hidden field with the same name with a blank value before the checkboxes. This way it’s always submitted, and clears the value if there’s no checkboxes clicked.
shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect |
github |
splittingred.com
Hi I am trying to achieve this with two sets of check boxes but for some reason the default is not being overwritten with a space when doing an updateprofile. When I click back on the profile it is still showing what was previously selected as well as any new selection.
I have a checkbox with 3 fields for saver, lender or developer.
and then two checkboxes for High Net Worth or Sophisticated Lender.
Here is my code if you can help at all?
<p>[[!UpdateProfile? &validate=`fullname:required,email:required:email`]]</p>
<div class="update-profile">
<div class="updprof-error">[[+error.message]]</div>
[[+login.update_success:if=`[[+login.update_success]]`:is=`1`:then=`[[%login.profile_updated? &namespace=`login` &topic=`updateprofile`]]`]]</div>
<div class="update-profile"><br class="updprof-error" /><form class="form" action="[[~[[*id]]]]" method="post"><input type="hidden" name="nospam" value="" />
<p>Are you a Saver, Lender or Developer?</p>
<ul style="list-style: none;">
<li>
<input type="hidden" name="saver" value="[[+saver:default=` `]]" />
<input id="saver" class="checkbox" type="checkbox" name="saver" value="[[+saver:default=`Saver`]]" />
<label class="checkbox-label" for="saver-checkbox">Saver</label></li>
<li>
<input type="hidden" name="unpaid" value="[[+lender:default=` `]]" />
<input id="lender" class="checkbox" type="checkbox" name="lender" value="[[+lender:default=`Lender`]]" />
<label class="checkbox-label" for="lender-checkbox">Lender</label></li>
<li>
<input type="hidden" name="unpaid" value="[[+developer:default=` `]]" />
<input id="developer" class="checkbox" type="checkbox" name="developer" value="[[+developer:default=`Developer`]]" />
<label class="checkbox-label" for="developer-checkbox">Developer</label>
</li>
</ul>
<p><strong>Savers & Lenders Only</strong></p>
<ul style="list-style: none;">
<li><input type="hidden" name="highnetworth" value="[[+highnetworth:default=` `]]" /> <input id="highnetworth" class="checkbox" type="checkbox" name="highnetworth" value="[[+highnetworth:default=`High Net Worth`]]" /> <label class="checkbox-label" for="highnetworth-checkbox">I have signed the Self-Certified High Net Worth Individual Statement</label></li>
<li><input type="hidden" name="sophisticatedinvestor" value="[[+sophisticatedinvestor:default=` `]]" /> <input id="sophisticatedinvestor" class="checkbox" type="checkbox" name="sophisticatedinvestor" value="[[+sophisticatedinvestor:default=`Sophisticated Investor`]]" /> <label class="checkbox-label" for="sophisticatedinvestor-checkbox">I have signed the Self-Certified Sophisticated Investor Statement</label></li>
</ul>
<br />
<label for="fullname">[[!%login.fullname? &namespace=`login` &topic=`updateprofile`]] <span class="error">[[+error.fullname]]</span> </label>
<input id="fullname" type="text" name="fullname" value="[[+fullname]]" /> <br />
<label for="email">[[!%login.email]] <span class="error">[[+error.email]]</span> </label>
<input id="email" type="text" name="email" value="[[+email]]" /> <br /> <label for="phone">[[!%login.phone]] <span class="error">[[+error.phone]]</span> </label> <input id="phone" type="text" name="phone" value="[[+phone]]" /> <br />
<label for="mobilephone">[[!%login.mobilephone]] <span class="error">[[+error.mobilephone]]</span> </label>
<input id="mobilephone" type="text" name="mobilephone" value="[[+mobilephone]]" /> <br />
<label for="fax">[[!%login.fax]] <span class="error">[[+error.fax]]</span> </label>
<input id="fax" type="text" name="fax" value="[[+fax]]" /> <br />
<label for="address">[[!%login.address]] <span class="error">[[+error.address]]</span> </label>
<input id="address" type="text" name="address" value="[[+address]]" /> <br />
<label for="country">[[!%login.country]] <span class="error">[[+error.country]]</span> </label>
<input id="country" type="text" name="country" value="[[+country]]" /> <br />
<label for="city">[[!%login.city]] <span class="error">[[+error.city]]</span> </label>
<input id="city" type="text" name="city" value="[[+city]]" /> <br /> <label for="state">[[!%login.state]] <span class="error">[[+error.state]]</span> </label> <input id="state" type="text" name="state" value="[[+state]]" /> <br />
<label for="zip">[[!%login.zip]] <span class="error">[[+error.zip]]</span> </label>
<input id="zip" type="text" name="zip" value="[[+zip]]" /> <br /> <label for="website">[[!%login.website]] <span class="error">[[+error.website]]</span> </label> <input id="website" type="text" name="website" value="[[+website]]" /> <br /> <br class="clear" />
<div class="form-buttons"><input type="submit" name="login-updprof-btn" value="[[!%login.update_profile]]" /></div>
</form></div>