• Resolved crduling

    (@crduling)


    I have a form on a medical site that allows staff to create a PDF on form submission; the form contains information such as patient name, diagnosis, and graft donor. It also contains the procedures necessary for the patient, such as dental implants. The PDF is supposed to have “blurbs” based on what procedures are selected, or pieces of information that are inserted onto the PDF based on what is clicked (if you have a procedure that involves IV, a blurb about IV appears after the IV checkbox is clicked). I do this by creating inputs that have default values (the default values being the blurbs) that only show when certain procedure checkboxes are clicked. For example, when “Ridge preservation” is clicked as a procedure, the following blurb appears:

    “I understand that the graft will be taken from {{gdonor}} and further that:” – and it continues from there.

    As you can see in the blurb, I need {{gdonor}} to be the value that is clicked on the “graft donor” checkbox.

    My question is: is there a way to insert data from one part of the form (the value of a clicked checkbox, for example) into another part of the form (the input value) on the same submission?

    Thanks for the support. Let me know if there are any questions.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support Nebu John – WPMU DEV Support

    (@wpmudevsupport14)

    Hi @crduling,

    Thank you for asking the question.

    Yes, this is possible with the HTML field in Forminator form. The Add Form Data button in the HTML field will embed any of the form’s field data into the HTML field if required. Please check this screenshot: https://tinyurl.com/43jadyme

    Reff: https://wpmudev.com/docs/wpmu-dev-plugins/forminator/#html-field

    Feel free to get back to us if you need any further clarification.

    Best Regards,
    Nebu John

    Thread Starter crduling

    (@crduling)

    Thanks for the response. The problem is that I need the field data to be accessible from an input field; I can’t use the HTML field to do what I’m trying to do with the PDF builder. Is there a way to embed form data into an input field? I’ve already tried referencing the checkbox number (typing {checkbox-3} in the input field) to no avail. Is there a way to do this?

    Plugin Support Nebu John – WPMU DEV Support

    (@wpmudevsupport14)

    Hi @crduling,

    I am sorry this isn’t possible with the Forminator form out of the box.

    A similar JS as the following can help with this as a workaround.

    jQuery('input[type=radio][name=radio-1]').change(function() {
        if (this.value == 'select-one') {
            jQuery('input[name=text-1]').val("You selected "+this.value);
        }
        else if (this.value == 'select-two') {
            jQuery('input[name=text-1]').val("You selected "+this.value);
        }
    });

    The above code changes the value of an input field based on the selection of a radio field. Please find the export of the test form here: https://pastebin.com/iVhA2guk

    I hope that helps, feel free to ask if you need any clarification.

    Best Regards,
    Nebu John

    Thread Starter crduling

    (@crduling)

    Okay, thanks! Where would I insert this JavaScript? Is there a place on Forminator to do so? Would I insert it in the HTML field?

    Plugin Support Predrag – WPMU DEV Support

    (@wpmudev-support1)

    Hi @crduling,

    You can use a plugin like this one https://wordpress.org/plugins/custom-css-js/ to add custom scripts.
    Or you can add it in your child theme functions.php or as mu-plugin.

    Cheers,
    Predrag

    Thread Starter crduling

    (@crduling)

    Okay, thanks a ton for your support. I’ll get going on this.

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @crduling

    You are welcome, feel free to keep us posted or ping if you have any additional question.

    Best Regards
    Patrick Freitas

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @crduling

    I hope you are doing well and safe!

    We haven’t heard from you in a while, I’ll mark this thread as resolved.

    Feel free to let us know if you have any additional question or problem.

    Best Regards
    Patrick Freitas

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Referencing checkbox value in an input in the same form’ is closed to new replies.