Hide Input Field
-
Hello
We have created a simple form with two input fields and the calculated field. On the front end, where the form is displayed, we need to hide one of the second input field (the second field is based on a set formula we have created). How can we hide the second field from displaying?
The page I need help with: [log in to see the link]
-
Hello @breakingnewground123
Thank you so much for using our plugin.
If you have a field with a static value, but this field must always be hidden, you can use a “Hidden” control directly (It is a control in the sidebar). If it is a calculated field, but you can make it always invisible, you can tick the “Hide field from public page” checkbox in calculated field settings. If are referring to any other control and you want to hide it from the public form, there are two alternatives, you can enter the
hide-strongpredefined class name through its “Add CSS Layout Keywords” attribute, or enter a pair display none CSS rule through its “Advanced Settings” tab.However, if the field is not a “Hidden” control or “Calculated Field” control with the checkbox attribute ticked (in both cases the plugin uses input tags with
type="hidden") and you want to show/hide it dynamically from a calculated field’s equation you can use the SHOWFIELD and HIDEFIELD operations.For example, assuming you have the equation fieldname1+fieldname2, and you want to show the fieldname3 if the sum is greater than 10 and hide it otherwise. You can edit the equation as follows:
(function(){
let result = fieldname1+fieldname2;
if(10 < result) SHOWFIELD(fieldname3|n);
else HIDEFIELD(fieldname3|n);
return result;
})()Note I included the |n modifier to the fieldname3 field. The plugin replaces the fields’ names with their corresponding values before evaluating the equations. The |n modifier tells the plugin you are referring directly to the field’s name instead of its value.
Finally, an important note. I used the SHOWFIELD and HIDEFIELD operations in the equation. They only show and hide the field but do not modify the field’s value or its inclusion in the form submissions. There is another pair of operations ACTIVATEFIELD and IGNOREFIELD that show and hide the fields, respectively, but additionally, they enable or disable the field. A disabled field is excluded from the form submissions, and their values are managed as zero by the equations.
Learn more about these operations in the “Managing Fields Operations” module by visiting the following link to the plugin documentation:
https://cff.dwbooster.com/documentation#managing-fields-module
Best regards.
Hello
Many thanks, we want to hide the “Second Number” from Public view and we added hide-strong in Add CSS Layout Keywords and clicked Save. However this does not appear in the “Field label” dropdown option in the Advanced Tab, what else do we need to do? Also if that Second Number field is hidden from Public view does the formula in Calculated Field still perform the calculations in the form.
Many thanks
Hello @breakingnewground123
Could you please indicate the exact URL that contains the form?
Best regards.
Hello
Its in our Staging Site at the moment, do you need a Temporary Access Token to the site?
Many thanks
Hello @breakingnewground123
I need to check the form in action to ensure you have assigned the hide-strong class name to the correct field and attribute. So, I need only the link to the public form and that you indicate the field’s name (fieldname#)
Best regards.
Hello,
Thanks, we refreshed the Cache and it is now working.
Many thanks
The topic ‘Hide Input Field’ is closed to new replies.