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

Question

Question

Contract Fields

asked on January 4, 2017 Show version history

I am trying to figure out the Custom HTML that would be required to do the following:

 

1. Customer chooses name from drop down list.

2. Based on this selection - autofill all areas of the Contract where their name needs to go.  This section is a HTML field on the form with all the contract text.  

 

Thanks!

1 0

Answer

SELECTED ANSWER
replied on January 4, 2017

Have the filled in areas be given ids/classes and use javascript to fill them in on the drop down change. Something along these lines.

<p>Hi my name is <span class="name"></span></p>

$("dropdownId select").on("change", function() {
    var name = $(this).val();
    $(".name").text(name);
});

 

0 0
replied on January 4, 2017

Okay so if this is my text body (added the recommendation in bold):

<p>The following constitutes a Memorandum of Understanding (M.O.U.) between Loudoun County, Department of Parks, Recreation and Community Services, to be known as (PRCS), and </p><p>Name  <span class="name"></span></p>.

 

And I added this as the javascript on the CSS and Javascript page:

$("q46 select").on("change", function() {
    var name = $(League_Name).val();
    $(".name").text(name);
});

 

I am probably missing something because it doesn't change the text.  Any ideas?

0 0
replied on January 4, 2017

you are missing a few things. q46 is an id so it needs to be #q46. Not sure what League_Name is referring to, but it should be referring to the selected value of the dropdown.

0 0
replied on January 4, 2017

Gotcha - League_Name is the variable for the drop down.  So if the drop down has 50 possible choices how would I display that?

0 0
replied on January 5, 2017

You will want to give the dropdown a css class (ex league_name) then get the current value by:

var name = $(".league_name option:selected").text();

 

0 0
replied on January 5, 2017

Okay I think I am just making a rookie mistake now.  I attached pictures of the dropdown info and here is the javascript:

$("#q46 select").on("change", function() {
  var name = $(".league_name option:selected").text();
    $(".league_name").text(name);
});

For HTML I have:

<p>league name  <span class="league_name"></span></p>

 

Thanks again for helping out!

LeagueName.PNG
LeagueName2.PNG
LeagueName.PNG (32.25 KB)
0 0
replied on January 5, 2017
$(document).ready(function() {
  $("#q46 select").on("change", function() {
    var name = $(".league_name option:selected").text();
    $(".league_name input").val(name);
  });
});

Don't give the span and the dropdown the same class name

0 0
replied on January 5, 2017

Makes sense.  So I made the span:

<p>name  <span class="name"></span></p>

 

Use Javascript in your last response, right?

 

Thanks again!

0 0
replied on January 5, 2017

yes just make sure to adjust the last line

0 0
replied on January 5, 2017

last line of javascript, right?  

 

so it would be:

$(".name input").val(name);

0 0
replied on January 5, 2017

yes

0 0
replied on January 5, 2017

Thanks for all the help.  I can't seem to get it to populate the name once a selection happens on the drop down, but I'll keep working on it.  

0 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.