Viewing 1 replies (of 1 total)
  • Plugin Author codepeople

    (@codepeople)

    Hi,

    There are different solutions, so, I’ll explain one of them:

    1. Assign a class name to the calculated field, for example: my-field (the class names are assigned to the fields through the attribute: “Add Css Layout Keywords”)

    2. I will assume you want to redirect the user to the URL: https://www.demo.com/page_a if the value of the calculated field is 1, to the URL: https://www.demo.com/page_b if the value of the calculated field is 2, and to the URL: https://www.demo.com/page_c if it is 3. Insert a “HTML Content” field in the form, and enter as its content the piece of code:

    <script>
    function myOnClick(){
    var v = jQuery('.my-field input').val(), url;
    if( v == 1) url = 'https://www.demo.com/page_a';
    if( v == 2) url = 'https://www.demo.com/page_b';
    if( v == 3) url = 'https://www.demo.com/page_c';
    
    if(typeof url != 'undefined') document.location.href=url;
    }
    </script>

    3. Finally, enter as the onclick event of the “button” field, a calling to the previous function: myOnClick();

    and that’s all.
    Best regards.

Viewing 1 replies (of 1 total)
  • The topic ‘Button with link’ is closed to new replies.