You are viewing limited content. For full access, please sign in.

Question

Question

Pass variable in URL from one form to the next

asked on January 13 Show version history

I have a non-submit form that functions basically as a landing page, then based on the questions the user answers, it uses field rules to present them with a link to another form. I am trying to pass the variable they entered on the first form to the second form by way of the URL.  Below is the code for one of the links. It is not passing the value entered in TaxMap in form #1 to Tax_Map_ID__ in form #2. 

 

This is from the relevant section on form #1:

0 0

Answer

SELECTED ANSWER
replied on January 13 Show version history

As Kevin stated, the HTML is populated when the form is initially loaded, so that is before the value was populated.  Here's some Javascript (for the Classic Designer, since that is how your post was tagged) that checks for changes to the field and updates the link.  To use this code, add the Class name of taxMap to your TaxMap field, and the Class name of taxMapLink to your HTML element with the link: 

$(document).ready(function() {
  
  //When the field with the taxMap class is updated,
  //update the HTML link using that value for the secondary form.
  $('.taxMap input').change(function() {
    let taxMapValue = $(this).val();
    let taxMapHTML = '<p><a href="URL_GOES_HERE?Tax_Map_ID__=' + taxMapValue + '" title="TITLE_GOES_HERE" target="_blank"><b><font size="3">Link to Apartment Survey Form</font></b></a><br></p>';
    $('.taxMapLink').html(taxMapHTML);
  });
  
});

 

2 0
replied on January 14

This has worked flawlessly. Many thanks! 

1 0
replied on January 14

Happy to help!

0 0

Replies

replied on January 13

You can't use a variable in an HTML field in real-time like that. It will only work if the form containing the field it is referencing has already been submitted at the time that you are displaying the HTML. You'd have to rewrite the contents using JS or display the link after the form is submitted. I'm not a JS expert, but I believe it would be similar to the code referenced here: https://answers.laserfiche.com/questions/207227/Forms-11-New-Form-Designer--Javascript-to-set-a-Field-Value-to-the-Text-value-in-a-Dropdown-choice#207827

2 0
You are not allowed to follow up in this post.

Sign in to reply to this post.