• Resolved justin_19

    (@justinsmith19)


    Hi @codepeople,

    I would like to have certain checkbox options required when filling in a form.

    For example, if there are three checkbox options, “Red”, “Green”, and “Blue”, is it possible to make the “Red” option required? So that when the user wants to submit the form, it shows an error saying the correct option must be chosen.

    Please advise whether this can be done.

    Regards

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @justinsmith19 
    
    In this case, you should separate the choices in different fields, one per field, and then configure the fields as required.
    
    Best regards.
    Thread Starter justin_19

    (@justinsmith19)

    Hi @codepeople,

    I would need to show an error message or unsuccessful message when the user fills in the incorrect field. How would I do this?

    Please advise

    Thanks

    Plugin Author codepeople

    (@codepeople)

    Hello @justinsmith19

    I’m sorry, but I would need additional details.

    If a field is configured as required and you try to submit the form, the plugin displays an error message for the required field.

    Best regards.

    • This reply was modified 3 years, 11 months ago by codepeople.
    Thread Starter justin_19

    (@justinsmith19)

    Hi @codepeople,

    My apologies, perhaps I’m not explaining this correctly.

    For example, in the form, there is the following question: Do you own any assets?
    The checkbox options are “Yes” and “No”.

    If the user selects “Yes”, then they can successfully continue their form and click Submit, and their form will be sent.

    However, if the user selects “No”, then when they click Submit, an error message will show and their form will not be sent.

    Let me know if this makes sense and whether it can be achieved.

    Thanks

    Plugin Author codepeople

    (@codepeople)

    Hello @justinsmith19

    The preferred solution, in this case, would be to configure the submit button as dependent on the “Yes” choice in the checkbox field, and an “Instruct. Text” field with the error message as dependent on the “No” choice.

    If you want to configure the submit button as a dependent field, you must emulate the submit button with a button field:

    1. Select the “no” option for the “Display submit button?” attribute in the form’s settings.

    2. Insert a button field in the form with the following piece of code as its onclick event:

    
    jQuery(this.form).submit();
    

    3. Finally, configure this field as dependent on the “Yes” choice in the checkbox field.

    More information about dependencies by reading the following post in the plugin’s blog:

    https://cff.dwbooster.com/blog/2020/03/01/dependencies/

    Best regards.

    Thread Starter justin_19

    (@justinsmith19)

    Hi @codepeople,

    This almost works.

    I have multiple questions, whereas all answers need to be “Yes” in order for the button to show.

    How do I make the button dependant on all those fields?

    Thanks

    Plugin Author codepeople

    (@codepeople)

    Hello @justinsmith19

    You can insert a calculated field as an auxiliary, and configure the button as dependent on the equation’s result.

    Best regards.

    Thread Starter justin_19

    (@justinsmith19)

    Thanks so much @codepeople.

    Y’all are awesome!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Required checkbox option’ is closed to new replies.