Duplicate submit button then make copy conditional.

By: Phil Cox | Asked: 03/25/2024
ForumsCategory: General questionsDuplicate submit button then make copy conditional.
Phil Cox asked 3 weeks ago

I found your explanation at "Formidable Masterminds" on how to move the Submit button to the top.
But I was asked to duplicate, rather than move.
I copied the Submit button code to Custom HTML > Before Fields.  So Before Fields now looks like this:

<legend class="frm_screen_reader">[form_name]</legend>
[if form_name]<h3 class="frm_form_title">[form_name]</h3>[/if form_name]
[if form_description]<div class="frm_description">[form_description]</div>[/if form_description]
<div class="frm_submit frm_flex">
<button class="frm_button_submit" type="submit" [button_action]>[button_label]</button>
[if back_button]<button type="submit" name="frm_prev_page" formnovalidate="formnovalidate" class="frm_prev_page" [back_hook]>[back_label]</button>[/if back_button]
</div>

Now I have a request that the duplicated submit button at the top of the form should only be visible to an editor when they have opened the form to edit an entry.

This is to prevent confusion to normal users who could press the top select button before completing the fields.

Is there a way to add this degree of control?

Many thanks,
Phil.

1 Answers
Rob LeVineRob LeVine answered 3 weeks ago
Hey Phil,   You can add jQuery to check the value of the "frm_action" element.  Something like if ($("[name='frm_action']").val() != "update") then hide the button.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right