Fieldtype, Plugin

Developer
Supported

REEgion Select

ExpressionEngine 1.x, ExpressionEngine 2, ExpressionEngine 3, ExpressionEngine 4, ExpressionEngine 5, ExpressionEngine 6

Back to this add-on's main page
View Other Add-ons From Derek Hogue

     

You must be logged in to post.

Safecracker form with inline error handling - Reegion Select field clears value if error

General (Resolved)

cdfwebsolutions
cdfwebsolutions

I think this may be a bug, though I’m not sure if it’s REEgion Select or Safecracker…

With the following code in a Safecracker (profile update) form using inline error handling, the REEgion select field ‘resets’ to no option selected IF (and only if) there is an error in another field.  If there is not an error, everything is fine and the correct option shows as selected when editing the profile.

{exp:reegion_select:states type="alpha2" name="field_id_12" selected="{member_state}"

When the form reloads after failing to include a required field, this REEgion select field reverts back to having no value, even if a value was previously saved.

Hope that makes sense ... thanks!

cdfwebsolutions
# 1
cdfwebsolutions

I should have mentioned I’m using EE 2.5.3 and REEgion Select 2.1

Derek Hogue
# 2
Developer
Derek Hogue

Hmm - is {member_state} your custom field name? If so, try:

selected="{member_state:alpha2}" 
cdfwebsolutions
# 3
cdfwebsolutions

Well, now the field doesn’t preserve its value at all.  Was this what I was supposed to do?:

{exp:reegion_select:states type="alpha2" name="field_id_12" selected="{member_state:alpha2}"

Not sure if this is relevant, but the form is a Zoo Visitor update form, but that’s just basically a Safecracker form.

Derek Hogue
# 4
Developer
Derek Hogue

Yeah, that’s correct - it’s odd that it work at all otherwise, because the field tag without :alpha2 specified will return the full name of the region, but the database stores the alpha2 code.

What happens if you use:

{field:member_state} 
cdfwebsolutions
# 5
cdfwebsolutions

Hey that works!  I feel a little stupid :)  I had tried that previously, but had to revert to the longer form.  Not sure what changed…

Thanks for the super-fast reply!!

Derek Hogue
# 6
Developer
Derek Hogue

Great! Glad that sorted it out.