Auto-fill text box values field based on the selection of the menu drop-down

Try to fill in address, city, province, zip from text fields based on the selected option in a select form field. The following code works fine in Internet Explorer, but in Chrome or Firefox, after selection, text, the fields are filled with the word "undefined."

I found a PHP script Jquery here version that would probabably do the trick.
http://StackOverflow.com/questions/3657127/jQuery-populate-text-input-from-table-based-on-select-Valeur

Maybe someone has a version of CF. they could share?

Thanks in advance to anyone who can point me to a solution for this code, or a better way to fulfill my need.

<!--> destinations with address auto-fill, city, etc.
< script type = "text/javascript" >
function selectAddress (list) {}
take the first element is empty
If (list.selectedIndex > 0) {}
var locationID = list.options [list.selectedIndex] .value;
locationAddress var = list.options [list.selectedIndex] .locationAddress;
var locationCity = list.options [list.selectedIndex] .locationCity;
var locationState = list.options [list.selectedIndex] .locationState;
var locationZip = list.options [list.selectedIndex] .locationZip;
document.getElementById('locationID').value = locationID;
document.getElementById('locationAddress').value = locationAddress;
document.getElementById('locationCity').value = locationCity;
document.getElementById('locationState').value = locationState;
document.getElementById('locationZip').value = locationZip;
}
}
< /script >
< b >
< td align = 'right' bgcolor = "#FFFFFF" valign = "top" > Destination name < table >
< td align = "left" bgcolor = "#FFFFFF" valign = "top" >
< select name = "locationID" onChange = "selectAddress (this)" class = "smallforms" > "
< option value = "" > SELECT the DESTINATION ››› < / option >
< cfoutput query = "allLocations" >
"" < option value = "" #locationName # "locationAddress =" #allLocations.locationAddress # "locationCity =" "#allLocations.locationCity #" locationState = "#allLocations.locationState #" locationZip = "#allLocations.locationZip #" > #locationName # < / option >
< / cfoutput >
< / select >

Others: cfinput name = "destinationNameOther" type = "text" class = "smallforms" size = "75" >
< br / >
< input id = "locationID" name = "locationID" type = "hidden" > < br >

Address: < input class = "smallforms" id = "locationAddress" name = "locationAddress" type = "text" size = "30" >
City: < input class = "smallforms" id = "locationCity" name = "locationCity" type = "text" size = "20" >
State: < input class = "smallforms" id = "locationState" name = "locationState" type = "text" size = "2" >
Postal code: < input class = "smallforms" id = "locationZip" name = "locationZip" type = "text" size = "8" > < br / >
< br / >
< table > < /tr >

In your last code done selectAddress refers to "index" but I'm not declared or assigned. I think that you are missing 'var index = list.selectedIndex;' statement.

Tags: ColdFusion

Similar Questions

  • Make the text visible/invisible field based on the menu drop-down

    I currently have a form that automatically calculates dates based on the value in particular the "Text10" field with the current script of

    Custom calculate script for the field 'date '.

    (function () {}

    Get the date in the field

    var v = getField("Text10").valueAsString;

    Convert string to date

    var d = util.scand ("mm/dd/yyyy", v);

    Add 30 days

    d.setDate (d.getDate () + 31);

    Fill in this field with the result

    If {(v)

    Event.Value = util.printd ("mm/dd/yyyy", d);

    } else {}

    Event.Value = "";

    }

    })();

    I want to thank this option to hide the field if one selects a particular value in a drop-down list. Allows to call the drop "decline.1" and values are just 'Yes' and «» Yes makes visible, hide it.

    Is this possible? I looked through the forums and can't seem to find a solution. I use Adobe Acrobat X Pro

    Thank you

    Yes, it is possible. Just add the following line, this isn't little matter so long it after the first year and before the last:

    Event.Target.Display = getField("drop1").value = 'no '? Display.Hidden: display.visible;

  • Please help guys - hide fields based on the menu drop-down - javascript - output (adobe livecycle)

    I'm trying to hide certain fields in a form that is based on any value selected from a drop down menu, as shown in the image below. My main dropdown has values such as $25, $50 $ 75 and based on what value is selected, I want to hide two text field and date field, I created. Also when you select a value of $1000 I want to hide the ' field Manager ($ 25 - $ 100).

    hidefields.jpg

    That's how I would solve the problem. Note that the numbers used in the comparisons are links in the drop down menu.

    I don't know if it solves your problem exactly, but he should at least get you on the right track.

  • Hide objects based on the menu drop-down

    Hey guys,.

    I hope someone here can help me. I've been browsing the forums and tried several options, but can't get anything to work.

    That's what I put in place:

    • Drop-down list with the following options:
      • All (value 1)
      • Specific (value 2)
      • Range (value 3)
    • Two different text boxes (a named range and the other named specific)

    What I'm trying to accomplish:

    Based on the drop-down menu, the boxes must be visible or hidden:

    • All (value 1). the two boxes are hidden
    • Specific (value 2); the specific box is visible, but the beach area is hidden
    • Range (value 3); the beach area is visible, but the specific box is hidden

    No matter what I try (JavaScript and FormCalc) I can't get this to work. If I start with hidden text areas they appear not visible, and when they begin to visible, they hide. I'm pulling my hair out on this one. Any help would be greatly appreciated.

    The error isn't in your code, it's in the form itself...

    In LiveCycle Designer, you have the properties of form that will design the PDF on how he'll react

    You form is set to be a static PDF and a large number of features are disabled in static PDF files

    To change your static to the dynamicform, follow the instructions:

    1. in LiveCycle, open your PDF form

    2. click on Files > in the form

    3. open the default values tab and change the last static dynamic dropdownlist (this option may not be necessary as it is for the side server only, but change still)

    4. open the overview tab and change ' Preview Adobe XML Form as ' of 'static PDF form' to 'shape dynamic XML'

    I hope that this will help there!

  • Fill in the field of text based on the menu drop down.

    Here's the scenario: I have 2 drop-down lists on page 1 (list1, List2). Based on this selection, I want to fill in a text field on page 2 with their values, after clicking on a button to update at the bottom of page 2. I use the button click event, but how can I get the actual values of each drop-down list on the previous page?

    You must give the full path to the objects (i.e. form1. Page1.DDListName.RawValue). look in the view hierarchy to see the structure you want. Conversely, you can place the cursor in the script editor where you want the reference to appear, hold done the key ctrl and move the mouse to the object you wish to reference (it will change into a V). Then click on the mouse and the appropriate for this object reference is displayed in the script editor.

    Paul

  • linking two fields and fill in the two field based on the list drop-down selection box 1

    I work for a small social service agency VERY small non-profit and I try to get our paperwork until the twentieth century. I hope someone here can help me. I have adobe acrobat, but not of other adobe products. I converted our word document that we use for client notes in fillable pdf format and so far everyone is excited to try it. I have a huge problem that I can't understand. I have a customer named created drop-down list box that contains a list of 300 customers. Box 2 is named customer ID and will contain a unique identification code assigned to each customer.

    For example:

    CUSTOMER ID customer JANE DOE 12345678

    So here is my question how can I ensure that when Unetelle is selected 12345678 is already filled in the second field?

    I fill the drop-down list with the names of customer and then enter the customer ID as the value of exports. Note You must have a unique name for each client.

    If your customer ID starts at zero, then you must use a custom JavaScript, so you can keep the zero non significant.

    For the customer ID field, you can use the following custom JavaScript code:

    Event.Value = this.getField("DropBoxFieldName').valueAsString;

    You will need to change DropBoxFieldName name of the drop-down list.

    You will need a mechanism for updating the new customer form and IDs names.

  • How to switch to TestStand a parameter value of LabVIEW in the Menu drop-down?

    I'm using LabVIEW with TestStand. Sometimes when I pass a parameter to a LabVIEW module and it's a ring Enum happening as a pretty drop-down menu where I can choose the required value, but sometimes the menu does not appear. How can ensure to pass the values of the ring always menu? I have attached a few photos to show the menu in TS.

    I appreciate your help.

    Thank you.

    H.P.

    Your order must be an enum. Your text ring is no different than a normal digital control. In your case, you cannot just replace the text with an enum ring because an enum requires unique values, and you have several selections with 'Reserved' in the form of text.

  • Display of the image based on the menu drop down.

    I'm new to the Live Cycle Designer and trying to create a form where you can select a name of an image in a drop-down list and the image appears on the page to print.  The images would be vary in size, so what matters.

    I have copy and pasted using Microsoft Front Page code and it works but not sure how to convert a .pdf file.   Maybe it is not even possible I wonder where the images reside?

    Here's my code for the cover Page:

    < html >
    < head >
    < script type = "text/javascript" >
    {Window.OnLoad = Function ()}
    setImage() {} function
    var img = document.getElementById ('image');
    IMG. SRC = this.value;
    Returns false;
    }
    document.getElementById("ImageList").onchange = setImage;
    }

    < /script >


    < / head >
    < body >

    < select id = 'ImageList' >
    < option value = "images/transimage.gif' > Select Image < / option >"
    < option value = "images/image1.gif" >
    Image 1 < / option >
    < option value = "images/image2.jpg" >
    Image 2 < / option >
    < / select >

    < p > < img id = "image" src = "images/transimage.gif" / > < / p > "

    < / body >


    < / html >


    Thanks for any help.

    If you did that the value of exports is set on the binding tab, then it should work. You save the form as a "dynamic" PDF vs static? Otherwise, try recording in a dynamic form.

  • Mobile side.  Using the drop down of your video.  I once put some text on the Mobile page the Menu drops down, but behind the image.  When I remove the text box the menu works correctly.  This also happens with a HTML code placed to Paypal.

    Mobile side.  Using the drop down of your video.  I once put some text on the Mobile page the Menu drops down, but behind the image.  When I remove the text box the menu works correctly.  This also happens with a HTML code placed to Paypal.

    Please check layers panel and put in place the menu item in the list, you can use the layers panel and move up or attempt to move the content.

    If there is still the same, then download a few screenshots of the design view.

    Thank you

    Sanjit

  • My panels are not displayed when I click on it in the menu drop-down windows. The box appears but not the Panel. Can anyone help?

    My panels are not displayed when I click on it in the menu drop-down windows. The box appears but not the Panel. Can anyone help?

    Try to reset your preferences using Cmd (LTRC) - Opt (Alt) - move when restart you the version of AI. Did you once two monitors?

  • Try to make a drop-down list automatically calculate another field, but it is only caclulating a menu drop-down

    I am currently using Acrobat to create a form to fill out. Basically I want the selection in the drop down from the provinces to calculate the taxes of the SubShip field. I have 3 fields of text labeled GST, HST and PST and the selection must fill each box respectively. However, with the code that I use now, it is calculation only 13% of the SubShip field any province is selected, and it is only showing in the box of HST. Here is my code, and I have no idea where I'm wrong.

    Can someone please?

    var sNewSel = event.value;

    Switch (sNewSel) {}

    case "Ontario":

    this.getField("HST").value = (this.getField (subtotal) .value +)

    this.getField ("Shipping") .value) * this.getField("0.13").value;

    this.getField("PST").value = '0 ';

    this.getField("GST").value = '0 ';

    break;

    }

    var sNewSel = event.value;

    Switch (sNewSel) {}

    case "Prince Edward Island":

    this.getField ("SubShip") .value = this.getField("HST").value * this.getField("0.14").value;

    this.getField("PST").value = '0 ';

    this.getField("GST").value = '0 ';

    break;

    }

    var sNewSel = event.value;

    Switch (sNewSel) {}

    case "Alberta":

    this.getField ("SubShip") .value = this.getField("GST").value * this.getField("0.05").value;

    this.getField("HST").value = '0 ';

    this.getField("PST").value = '0 ';

    break;

    }

    var sNewSel = event.value;

    Switch (sNewSel) {}

    case 'British Columbia':

    this.getField ("SubShip") .value = this.getField("GST").value * this.getField("0.05").value;

    this.getField ("SubShip") .value = this.getField("PST").value * this.getField("0.07").value;

    this.getField("HST").value = '0 ';

    break;

    }

    var sNewSel = event.value;

    Switch (sNewSel) {}

    case "Manitoba":

    this.getField ("SubShip") .value = this.getField("GST").value * this.getField("0.05").value;

    this.getField ("SubShip") .value = this.getField("PST").value * this.getField("0.08").value;

    this.getField("HST").value = '0 ';

    break;

    }

    var sNewSel = event.value;

    Switch (sNewSel) {}

    case "New Brunswick":

    this.getField ("SubShip") .value = this.getField("HST").value * this.getField("0.13").value;

    this.getField("GST").value = '0 ';

    this.getField("PST").value = '0 ';

    break;

    }

    var sNewSel = event.value;

    Switch (sNewSel) {}

    case "Nova Scotia":

    this.getField ("SubShip") .value = this.getField("HST").value * this.getField("0.15").value;

    this.getField("GST").value = '0 ';

    this.getField("PST").value = '0 ';

    break;

    }

    var sNewSel = event.value;

    Switch (sNewSel) {}

    case "Nunavut":

    this.getField ("SubShip") .value = this.getField("GST").value * this.getField("0.05").value;

    this.getField("HST").value = '0 ';

    this.getField("PST").value = '0 ';

    break;

    }

    var sNewSel = event.value;

    Switch (sNewSel) {}

    case "Quebec":

    this.getField ("SubShip") .value = this.getField("PST").value * this.getField("0.9975").value;

    this.getField ("SubShip") .value = this.getField("GST").value * this.getField("0.05").value;

    this.getField("HST").value = '0 ';

    break;

    }

    var sNewSel = event.value;

    Switch (sNewSel) {}

    case "Saskatchewan":

    this.getField ("SubShip") .value = this.getField("GST").value * this.getField("0.05").value;

    this.getField ("SubShip") .value = this.getField("PST").value * this.getField("0.05").value;

    this.getField("HST").value = '0 ';

    break;

    }

    var sNewSel = event.value;

    Switch (sNewSel) {}

    case "Yukon":

    this.getField ("SubShip") .value = this.getField("GST").value * this.getField("0.05").value;

    this.getField("HST").value = '0 ';

    this.getField("PST").value = '0 ';

    break;

    }

    var sNewSel = event.value;

    Switch (sNewSel) {}

    case "Newfoundland":

    this.getField ("SubShip") .value = this.getField("HST").value * this.getField("0.13").value;

    this.getField("GST").value = '0 ';

    this.getField("PST").value = '0 ';

    break;

    }

    var sNewSel = event.value;

    Switch (sNewSel) {}

    case "The Northwest Territories":

    this.getField ("SubShip") .value = this.getField("GST").value * this.getField("0.05").value;

    this.getField("HST").value = '0 ';

    this.getField("PST").value = '0 ';

    break;

    }

    Your link does not have access to the folder.

    You error means there is an error in the name of the field used in the script. You must check very carefully the spelling and capitalization of the name of the field.

  • How to change the text size in the menu drop down labels?

    How to change the size of text in the label drop-down list box?

    Extension of theme font & size changer.

    https://addons.Mozilla.org/en-us/Firefox/addon/theme-font-size-changer/

  • If the default value in the menu drop-down Dynamics

    Hello

    I created a menu drop-down simple which can be used to edit an existing record or create a new record.

    When you create a new record, I would like to than the drop down menu to display "Unspecified" by default. Could someone help me with this?

    'Unspecified' option in the drop down should view record ID 11 in my database table called "names".

    Here is what my code looks like this day.

    Db queries:

    < CFQUERY DATASOURCE = "DATA" NAME = "get" >
    SELECT *.
    Names
    by name
    < / CFQUERY >


    < CFQUERY DATASOURCE = 'DATA' NAME = 'quo' >
    SELECT *.
    LEAVE quotes
    WHERE quoteID = #quoteID #.
    < / CFQUERY >

    This part is for the registration of existing database:

    < select name = "frn_ID" >
    < cfoutput query = "get" >
    < option value = "#id #" < cfif id is quo.frn_ID > selected < / cfif > > #name # < / option >
    < / cfoutput >
    < / select >

    Here is where I would like the ID with a default value of 11 to display:

    < cfelse >
    < select name = "frn_ID" >
    < cfoutput query = "get" >
    < option value = "#id #" > #name # < / option >
    < / cfoutput >
    < / select >

    < / cfif >

    Thanks for any help with this!

    Luke

    Step 1 - make certain if/else treatments to create a variable, call the ThisOne, who will be the id of the option of your choice is selected.

    Step 2: use this variable in the selected attribute to a cfselect tag.

  • Link a text box to a value of selected list of the menu drop-down

    I have a drop drown list 5 names in Adobe Acrobat PDF format. Based on the name of the person, that you select in the menu dropdown I would like the text box automatically fill with the telephone number of this person. For example:

    Drop down the list the name of the field ('Name')

    Jake

    Bob

    Maria

    Field name of phone numbers ('number') so that the number of simplicity, Jake is 100 and so on.

    Jake / / 100

    Bob / / 200

    Maria / / 300

    My code does not work and I am close to understand, do you know what is the problem?

    var x = 100;

    var y = 200;

    var z = 300;

    If ((this.getField('Name').) Value = 'Jake')

    this.getField('Number').value = x;

    var a = this.getField ('Name');

    var two = this.getField ('Number');

    If (one.value == 'Jake') {two.value = '100'}

    If (one.value == "Bob") {two.value = '200'}

    If (one.value == 'Maria') {two.value = '300'}

    If (one.value == "") {two.value = ""}

  • Empty text box value when reading about the LV2012 development system but no Production

    Development platform: 32-bit Windows 7, LV2012 Professional Development System.

    Production of platforms: Windows XP.

    We have a test application, we have developed (in haste, I might add) who has a curious problem.  As part of the installation for each test, read us a text box with a serial number entry and record them in the log files.  Series enough.

    This works very well on production machines - no apparent problem.

    However, on the development computer, when I try to read the text box, all I get is an empty string.  I tried to read directly from the Terminal, as well as using a property value box.  Each time, there is nothing in the string.  This is even though I'm looking at the text box and there are visible data in it.

    Clear the text box repeatedly, I'm looking to see if any of those that occur at the wrong time.  And, indeed, I am looking a probe value of ' ' from the property node Value with the string "1234" visible in the text box while NONE of the compensation functions have been affected.

    The test application uses a pretty standard user interface event loop model, with an event loop manages the user input and the other event loop manages the business logic.

    Anyone have any idea what can cause this, or a better search string to find clues?

    Thank you

    Geoff

    As promised, I did go to the bottom of it.

    Simply enable "update of value while typing" gave me the result I expected.

    To explain: I had a key event down to the first text box that has been copied to this text box.  Whenever a key was hit in this text box, the value would be read and updated.  I did not have all the events for the new text box.  It has not been updated to what some other events.  At that time, it was apparently too late (most of the time on the development computer) and occasionally on the Production machine.

    Activation of the "Update value while typing" indicator means that the value field would properly up-to-date each time he has been seen/accessible.

    Life is a learning experience...

Maybe you are looking for