• Resolved giuseppe65

    (@anguria65)


    Hi,
    I have read the documentation on relations, but it is not clear to me if, for example I have two shortcodes of two forms in one page, fieldname1 of form id 2 can be related to fieldname1 of form id 1. In this case the minimum value of field fieldname Could 1 of form id 2 be set equal to fieldname of form id 1?
    Is it also possible to make the form id 2 visible only by clicking on a button?
    I hope I have been able to explain what I would like to achieve.

    Thanks.

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

    (@codepeople)

    Hello @anguria65

    You cannot use the common mechanisms of min values or dependencies if the fields belong to different forms.

    If you want to use values of fields in form A from form B, you must use your own code.

    For example, you can assign a unique class name to the field in form A, like field-a, and insert a hidden field in form B and assign a unique class name to this field too, like field-b.

    Now, you can insert an “HTML Content” field in form B with the following piece of code as its content:

    <script>
    jQuery(document).on('.field-a input', 'change', function(){
    jQuery('.field-b input').val(this.value).change();
    });
    jQuery('.field-a input').change();
    </script>

    Finally, you can use in form B the hidden field as any other field in the form.

    To show form B by pressing a button, you can do the following:

    Insert the shortcode of form B into a div tag hidden by default.
    <div class="form-b" style="display:none;">shortcode here</div>

    Now, insert a button in form A with the onclick event:

    jQuery('.form-b').show();

    Best regards.

    Thread Starter giuseppe65

    (@anguria65)

    Hello @codepeople,
    I notice that you have replied to my topic but I cannot view the content.
    Thank you

    Thread Starter giuseppe65

    (@anguria65)

    Hello @codepeople,
    now I was able to see the answer.
    Thank you very much.

    Best regards.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Relationship between two forms on the same page’ is closed to new replies.