Events Made Easy › Forums › How do I … › Need clarification on use of #REQ – not working per docs info
- This topic has 4 replies, 2 voices, and was last updated 6 years, 1 month ago by Anonymous.
-
AuthorPosts
-
Thu 11 Oct 2018 at 22:28 #58535AnonymousInactive
I have a form field, type text, name ‘Organization’. It is not set as ‘required’ by default. Most use cases, I want it optional.
Now I have one use case (in one RSVP template) where I want it required.
Docs say:
“For any shortcode, if you start with “#REQ_” instead of “#_”, the field becomes required and cannot be left empty or 0 upon registration”So I am using #REQ_FIELD{Organization} in this template, to make it required.
The field correctly displays as ‘required’ on the page.
However when I submit the form, with some text in that field, I get the message that it is not filled out correctly:
“Please make sure all of the following required fields are filled out correctly: FIELDOrganization”I can put one letter or many words in the field, same result.
Also, in the form field editing UI, the selection for ‘required’ setting says:
“Use this if the field is required to be filled out.
This overrides the use of “#REQ” when defining a field in a format.”It is not clear to me what “This overrides the use of #REQ…” means. Clearly a setting of ‘no’ (not required) here does not override my use of #REQ in this case, since the field behaves as ‘required’.
Or is some conflict between the field’s default setting of ‘no’ and my use of #REQ what is causing the error when I use #REQ this way?thanks,
JohnFri 12 Oct 2018 at 00:27 #58537FrankyKeymaster2 things:
– first the use of #REQ or the setting “required” when defining the field: #REQ_FIELD{xx} makes the field required, even when the “required” setting for the field is off. When the required setting is on, then the field is always required (whether or not you use #REQ). So in essence, this does what you’re asking.
– Now it seems you’re reporting a bug when usng #REQ, so let me test that again.Fri 12 Oct 2018 at 00:44 #58538AnonymousInactiveOK, yes, the #REQ works per the docs (I still find the “override” comment on that selection in admin UI confusing – that’s why I wasn’t sure if this was bug or my own misunderstanding of functionality).
Then I have a bug as described – I use #REQ to make a non-required field required, but it behaves as described – shows required, but then no matter what I put in it, complains it is not filled in correctly.
NOTE if it helps debugging – this is a custom defined field that fails in this way, using #REQ_FIELD{Fieldname}.
In two different RSVP templates, I have the built-in field #_FIRSTNAME which I make required by using #REQ_FIRSTNAME in the template, and that works.
So from my limited example, #REQ appears to work for built-in fields but fails somehow when applied to custom-defined fields.
Fri 12 Oct 2018 at 00:56 #58539FrankyKeymasterThe bug has been confirmed and fixed here:
https://plugins.trac.wordpress.org/changeset/1955453/Simple workaround if you don’t want to apply the fix: use #REQ_FIELD{xx} with xx the field ID and not the fieldname.
Fri 12 Oct 2018 at 01:29 #58540AnonymousInactiveGreat, thanks…I have already done other workarounds for this one instance, so will just wait for the next upgrade that includes the fix.
Surprised nobody hit this before, seems a common use case. -
AuthorPosts
- The forum ‘How do I …’ is closed to new topics and replies.