And adding manually a piece of code in registration form? Can solve the problem?
<xen:elseif is="{$field.field_type} == 'radio'" />
<ul class="checkboxColumns">
<xen:if is="!{$field.required}">
<li><label><input type="radio" name="custom_fields[{$field.field_id}]" value="" {xen:checked '{$field.field_value} == ""'} /> <span class="muted">{xen:phrase no_selection}</span></label></li>
</xen:if>
<xen:foreach loop="$field.fieldChoices" key="$choice" value="$text">
<li><label><input type="radio" name="custom_fields[{$field.field_id}]" value="{$choice}" {xen:checked '{$field.field_value} == {$choice} OR ({$field.field_id} == "radiofield" AND {$choice} == "no" AND !{$field.field_value})'} /> {xen:raw $text}</label></li>
</xen:foreach>
</ul>
I suppose that would work:
Admin CP -> Appearance -> Templates -> custom_field_edit
Add the red code:
Rich (BB code):<xen:elseif is="{$field.field_type} == 'radio'" /> <ul class="checkboxColumns"> <xen:if is="!{$field.required}"> <li><label><input type="radio" name="custom_fields[{$field.field_id}]" value="" {xen:checked '{$field.field_value} == ""'} /> <span class="muted">{xen:phrase no_selection}</span></label></li> </xen:if> <xen:foreach loop="$field.fieldChoices" key="$choice" value="$text"> <li><label><input type="radio" name="custom_fields[{$field.field_id}]" value="{$choice}" {xen:checked '{$field.field_value} == {$choice} OR ({$field.field_id} == "radiofield" AND {$choice} == "no" AND !{$field.field_value})'} /> {xen:raw $text}</label></li> </xen:foreach> </ul>
You need to name the field_id and the option that is to be the default. Kind of hackish, but it works.
Can you give me a trick to Drop Down menus?
<xen:elseif is="{$field.field_type} == 'select'" />
<select name="custom_fields[{$field.field_id}]" id="ctrl_custom_field_{$field.field_id}" class="textCtrl">
<xen:if is="!{$field.required} OR !{$field.hasValue}">
<option value=""> </option>
</xen:if>
<xen:foreach loop="$field.fieldChoices" key="$choice" value="$text">
<option value="{$choice}" {xen:selected '{$field.field_value} == {$choice} OR ({$field.field_id} == "fieldid" AND {$choice} == "defaultvalue" AND !{$field.field_value})'}>{xen:raw $text}</option>
</xen:foreach>
</select>
Rich (BB code):<xen:elseif is="{$field.field_type} == 'select'" /> <select name="custom_fields[{$field.field_id}]" id="ctrl_custom_field_{$field.field_id}" class="textCtrl"> <xen:if is="!{$field.required} OR !{$field.hasValue}"> <option value=""> </option> </xen:if> <xen:foreach loop="$field.fieldChoices" key="$choice" value="$text"> <option value="{$choice}" {xen:selected '{$field.field_value} == {$choice} OR ({$field.field_id} == "fieldid" AND {$choice} == "defaultvalue" AND !{$field.field_value})'}>{xen:raw $text}</option> </xen:foreach> </select>
Same problem. The box is checked by defaul, but it is not applied.One issue. The same "default" checked field is in user preferences page also... but it's only cosmetic. No real preference is selected if user don't click the save button.
View attachment 26237
<ul class="checkboxColumns">
<xen:foreach loop="$field.fieldChoices" key="$choice" value="$text">
<li><label><input type="checkbox" name="{$customFieldInputName}[{$field.field_id}][{$choice})]" value="{$choice}" {xen:checked 'isset({$field.field_value.{$choice}}) OR ({$field.field_id} == "newsletter_news" AND !{$field.field_value})'} /> {xen:raw $text}</label></li>
</xen:foreach>
</ul>
Same problem. The box is checked by defaul, but it is not applied.One issue. The same "default" checked field is in user preferences page also... but it's only cosmetic. No real preference is selected if user don't click the save button.
View attachment 26237
INSERT INTO xf_user_field_value (user_id, field_id, field_value)
SELECT user_id, 'field_id', 'value'
FROM xf_user
ON DUPLICATE KEY UPDATE
field_value = VALUES(field_value);
That is expected because the template edit only affects the default value in the form. The form must be submitted.
But is this true for registration form also?
Sorry Jake, but I need to make "yes" the default choice of the field on registration, not after registration.
We use essential cookies to make this site work, and optional cookies to enhance your experience.