Muliple links to same form on a single web-page with varying parameters.

  • Norman Rouxel
    Asked on October 8, 2019 at 4:40 AM

    I have a client using a feedback form that is opened in a lightbox via new JotformFeedback(...).

    It's a product site and he has multiple products on a page and want to use JotForm as a "Request a Sample" capability.

    He wants to have multiple links to open this form per product on a page and to pre-populate a form field via iframeParameters to pre-set each form submission with different details depending on the product specific link clicked. 

    If I try to call new JotformFeedback(...) more than once I end up with a single form that initially appears empty and when its close button is pressed it displays repeated content.

    Is there a way I can have multiple links to the same form on a page, each with different iframeParameters?

  • Kiran Support Team Lead
    Replied on October 8, 2019 at 5:04 AM

    Could you share the webpage where the form is embedded so that we can check and assist you further?

  • Norman Rouxel
    Replied on October 8, 2019 at 7:51 AM
    Hi, Kiran

    Website using this (but with the workaround below is) http://www.drillpine.biz/v18-testsite/acatalog/Necklaces.html
    The “Request a Sample” links are the ones that fire JotForm.

    Problem is marked in red this code in form.jotformeu.com/static/feedback2.js

    setLinkListener:function(){
    var linkIdentifier='lightbox-'+this.options.formId;
    var $this=this;
    $jot("."+linkIdentifier).each(function(){
    $jot(this).click($jot.proxy($this.showWindow,$this));
    });
    $jot('#'+linkIdentifier).click($jot.proxy(this.showWindow,this));
    }

    This requires each link that uses the same form to have identical classnames and this ends up erroneously grouping the forms.

    My workaround is to use links like:

    Request a Sample

    And amending new JotformFeedback to add a parameter anc:

    And amending feedback2.js to use:

    setLinkListener:function(){
    var linkIdentifier='lightbox-'+this.options.anc;
    var $this=this;
    $jot("."+linkIdentifier).each(function(){
    $jot(this).click($jot.proxy($this.showWindow,$this));
    });
    $jot('#'+linkIdentifier).click($jot.proxy(this.showWindow,this));
    }

    I hope you understand the above and can provide a solution that doesn’t require modifying your code.



    Norman
    _____________________________________________

    Drillpine Ltd
    25 Sunbury Street, Edinburgh, UK.
    Registered in Scotland #SC097748.
    VAT registration number 429 4887 04.
    ______________________________________________



    ...
  • jherwin
    Replied on October 8, 2019 at 8:21 AM

    Actually, the workaround you created was the solution if you are embedding multiple feedback forms on the same webpage. This is due to the fact that your page/button makes multiple calls to the same JavaScript file if you do not change the code of the other feedback form.