This forum is no longer open and is for reading/searching only.
Please use our new MachForm Community Forum instead.
MachForm Community Forums » MachForm 4
The values of fields hidden through Logic rules
Started 8 years ago by myplatypus | 4 posts |
-
It seems that any field that is hidden using rules in the Logic panel does not POST its data when the user submits the form, regardless of whether the field had a default value set in the Form Builder or a value was passed into the form via a URL parameter. This also happens if I use "display: none" in the CSS for a field rather than a Logic rule.
Is this behavior by design? If so, is there a way to override it?
Here's my situation so you better understand what I'm trying to accomplish.
I have a field called "Pricing". It is a dropdown with three options -- A, B and C, for simplicity's sake. I have created a rule with an impossible condition in the Logic panel that hides the field so the user never sees the field. I set the value of the dropdown via a URL parameter when accessing the form. Using Chrome's Developer Tools, I can see that the value of the dropdown is correctly set prior to submitting the form. However, when the user does submit the form, MachForm disregards the fields value and leaves it blank in the database.
Posted 8 years ago # -
Just to clarify - you say you are hiding the field using the Logic panel. Instead of that, why not just make the field hidden on the form? When you edit the form, choose that field and there are three options: visible, hidden, admin only. Set it to hidden.
Posted 8 years ago # -
The same result: If the field is hidden, its value does NOT get POSTed when the form is submitted.
Posted 8 years ago # -
What version of Machform are you using? In version 4.7, I cannot confirm what you are reporting about hidden fields not posting when the form is submitted. I find the hidden fields receive the entries just fine. Make sure you are choosing "Hidden" and not "Admin Only", since fields with that attribute cannot collect data. If you are using an old enough version of Machform, you won't see "Hidden" as a choice.
I can confirm what you say about fields hidden by logic, but I am not sure if it qualifies as a bug since the primary purpose of hiding fields is to not collect data in them. In any case, applying the "Hidden" attribute to the fields is a simpler and more straightforward alternative.
By the way, if the value you want to keep hidden is always the same, you can set it in the form as a default value for the field instead of setting it with a URL parameter
Posted 8 years ago #
Reply
You must log in to post.