HELP! Script to populate a text field based off of whats picked in a dropdown on a previous page?

Alright hopefully i can explain this good enough.
I have a dropdown box that has two different options to pick from.  For example:
Dropdown1 has:  Option A
                         Option B
On the other page I have two text fields.  TextField1 just shows whatever is picked from the Dropdown1 (Option A or Option B).  TextField2 needs to do the following:  If Option A is picked i just need the field to stay blank.  If Option B is picked i need it to populate specific text.
I thought i figured out a way to do this but it seems that since it is on a different page the script will not fire.
Any help is much appreciated!!!!!!

Hi,
With the first issue: having the dropdown and the first textfield displaying the same value, the easy solution is to use Global Binding.
Make sure that the dropdown and the first textfield have the same name in the hierarchy.
The select one of them and in the Object > Binding palette, set the binding to Global.
In the dropdown go to the Object > Binding palette and make sure that "Specify values" is NOT ticked.
It is probably a good idea to set the textfield to read only, in the Object > Value palette. This would prevent the user overwriting the value set by the dropdown.
No script required. Whatever is in the dropdpwn will appear in the textfield.
The second issue needs a small script in the calculate event of the second textfield. This looks at the value in the first textfield (TextField1) and sets its own value. This is JavaScript:
if (TextField1.rawValue == "Option B")
     this.rawValue = "Specific text";
else
     this.rawValue = null;
There are some examples here: http://assure.ly/jtTkdO, http://assure.ly/fYCuQ2.
Hope that helps,
Niall

Similar Messages

  • How do I use Javascript to populate a text field based on a selection from a drop down box?

    Greetings,
    I have virtually no experience with JavaScript and I am trying to figure out how to add some basic automation features to an Adobe form.  I have a drop down box called "Hospital_Name" that will contain approximately 7 possible selections.  When the user makes a selection, I would like to have the text field (called "Hospital_Address") below the drop down box populate with the corresponding address for the selection.  I have the "Hospital_Address" text field configured for multiple lines and would like the address to have a line break between the street address and the city/state/zip.
    For example, if the user selected "Hospital 1", the text field would display:
    123 Main St
    Anytown, CA 12345
    Any help or examples you can provide would be greatly appreciated.

    You have the element names within the object within brackets.
    Make sure your brackets are properly placed and matched.
    // Place all pre-population data into a single data structure
    var Location = {
    "--Hospital--":{ line1: " ", line2: " " },
    "Bellevue Medical Center":{ line1: "2500 BMC Drive", line2: "Bellevue, NE 68123" },
    "CHI Bergan Mercy":{ line1: "7500 Mercy Road", line2: "Omaha, NE 68124" }, 
    "CHI Immanuel":{ line1: "6901 N. 72nd Street", line2: "Omaha, NE 68122" }, 
    "CHI Lakeside":{ line1: "16901 Lakeside Hills Court", line2: "Omaha, NE 68130" }, 
    "CHI Midlands":{ line1: "11111 S. 84th Street", line2: "Papillion, NE 68046" },
    "Creighton University Medical Center":{ line1: "601 N. 30th Street", line2: "Omaha, NE 68131" },
    "Nebraska Medical Center":{ line1: "4400 Emile Drive", line2: "Omaha, NE 68105" }
    // some debugging code to see location names;
    console.show();console.clear():
    for(I in Location) {
    console.println(I);
    // end debugging code;
    function SetFieldValues(Hospital_Name) {
        this.getField("AddLine1").value = Location[Hospital_Name].line1;
        this.getField("AddLine2").value = Location[Hospital_Name].line2;
    This is not a beginners task but requires a fair amount of knowledge about the structure of objects, defining strings, and structure of arrays.
    Are you sure you have all the field names correctly spelled and capitalized?
    Do you get any error in the JavaScript console?
    Just trying the line that defines the "Location", I get the following error:
    SyntaxError: invalid property id
    1:Console:Exec
    undefined
    All the form field in a PDF are processed by using JavaScript and any error in any script will stop JavaScript processing.
    It might help to have a link to the problem form.
    Make sure your brackets are properly placed and matched.
    // Place all pre-population data into a single data structure
    var Location = {
    "--Hospital--":{ line1: " ", line2: " " },
    "Bellevue Medical Center":{ line1: "2500 BMC Drive", line2: "Bellevue, NE 68123" },
    "CHI Bergan Mercy":{ line1: "7500 Mercy Road", line2: "Omaha, NE 68124" }, 
    "CHI Immanuel":{ line1: "6901 N. 72nd Street", line2: "Omaha, NE 68122" }, 
    "CHI Lakeside":{ line1: "16901 Lakeside Hills Court", line2: "Omaha, NE 68130" }, 
    "CHI Midlands":{ line1: "11111 S. 84th Street", line2: "Papillion, NE 68046" },
    "Creighton University Medical Center":{ line1: "601 N. 30th Street", line2: "Omaha, NE 68131" },
    "Nebraska Medical Center":{ line1: "4400 Emile Drive", line2: "Omaha, NE 68105" }
    function SetFieldValues(Hospital_Name) {
        this.getField("AddLine1").value = Location[Hospital_Name].line1;
        this.getField("AddLine2").value = Location[Hospital_Name].line2;

  • How do you auto-populate a text field based on entries in other text fields?

    I would like to be able to have a text field that populates as "Complete" or "Incomplete" based on whether all the mandatory text fields have been filled out or not.
    For example, if the "First Name," "Last Name," and "City" text fields are not filled out, the "completion status" text field will show "Incomplete" and once they are filled out, the "completion status" text field will turn into "Complete."
    How would I do this using javascript? I've searched the web for a tutorial, but most of the results seem to be dropdown-centric.
    Please point me in the right direction!

    Try the script below. I put this on the calculate event for Field1
    if(FirstName.rawValue == null || LastName.rawValue == null || City.rawValue == null){
    Field1.rawValue = "Incomplete"
    else
    Field1.rawValue = "Complete"

  • How to script text field based on checkbox selection

    I've written a script to format specific text boxes based on what checkbox is chosen. However, I'm not sure what I need to script in order to CLEAR the text field once the checkbox is unchecked. As it stands now if the checkbox is selected it formats the text field with the necessary information, but if it's unchecked the information stays in the box. I'd like to be something like 'if all boxes are Off then display 0.00.' I've included the current script for reference
    var one = this.getField("Emp 500");
    var two = this.getField ("Emp+C500");
    var three = this.getField("Emp+S500");
    var four = this.getField("Fam500");
    var five = this.getField("NC500");
    var six = this.getField("Medical");
    if (one.value == 'Yes') {six.value='70.70'}        
    else if (two.value ==
    'Yes') {six.value='127.20'}
    else if (three.value == 'Yes') {six.value='141.32'}
    else if (four.value == 'Yes') {six.value='198.00'}
    else if (five.value == 'Yes') {six.value='0'}
    var one = this.getField("Emp 1500");
    var two = this.getField ("Emp+C1500");
    var three = this.getField("Emp+S1500");
    var four = this.getField("Fam1500");
    var five = this.getField("NC1500");
    var six = this.getField("Medical");
    if (one.value == 'Yes') {six.value='61.47'}
    else if (two.value == 'Yes') {six.value='110.49'}
    else if (three.value == 'Yes') {six.value='141.32'}
    else if (four.value == 'Yes') {six.value='123.04'}
    else if (five.value == 'Yes') {six.value='0.00'}

    Hi Gayathri,
    Gayathri Venugopal wrote:
    Hi,
    I have two text items. Need to create dynamic action for the following,
    1. Order_type - Drop down values having CONSUMER & WHOLESALE.
    2. Order_number- Text field
    Order number should be disabled and only on selection of order type ,order number should be enabled.
    Can someone please help me on this?
    Create two dynamic action
    1. Make it order number item disable on page load.
       Event : Page Load
       Action : Disable
       Fire When event result is : True
       Selection Type : Item
       Item : Your order number item
    2 . enable and disable order number on selection of order type(assuming when order type is null it is disable otherwise it is enable)
        Event : Change
        Selection type : item
        Item : your order type item
        condition : is not null
    True Action
        Action : Enable
        Fire When event result is : True
        Fire on page load : True
        Selection Type : Item
        Item : Your order number item
    False Action
        Action : Disable
        Fire When event result is : False
        Fire on page load : True
        Selection Type : Item
        Item : Your order number item
    Hope this helps you,
    Regards,
    Jitendra

  • Populate text field based on the lov selected value

    Hi,
    based on the value selected in lov, i want to populate another text field. Below is the code I have written
    In PFR:
    if(pageContext.isLovEvent())
    String lovInputSourceId = pageContext.getParameter(SOURCE_PARAM);
    if ("lovCategory".equals(lovInputSourceId))
    java.util.Hashtable lovResults = pageContext.getLovResultsFromSession(lovInputSourceId);
    if(lovResults!=null)
    String value =(String)lovResults.get("lovCategory");
    amobj.categorycode(value);
    AMImpl code:
    public void categorycode(String code) {
    sundryCodeVOImpl vobj = getsundryCodeVO1();
    vobj.setWhereClause( "lookup_code = "+"'"+code+"'");
    vobj.reset();
    vobj.executeQuery();
    String desc = vobj.first().getAttribute("Description").toString();
    String attr = vobj.first().getAttribute("Attribute1").toString();
    testEOViewImpl vobj1 = gettestEOView1();
    vobj1.getCurrentRow().setAttribute("CodeDescription",desc);
    vobj1.getCurrentRow().setAttribute("PurchasingCategoryCd",attr);
    vobj1.executeQuery();
    With this code, the updated values for the attributes CodeDescription, PurchasingCategoryCd are getting inserted into the database table but they are now showing up in the text fields when a value is selected in lov.
    Please tell me what is the mistake I'm doing.
    Thanks
    Sunny

    I'm using Lov Map to populate the lov field say field A. But I need to populate another field say field B based on the value selected in field A.
    to give an example of my requirement. Consider a view object having attributes col1,col2,col3 and having following data.
    col1--col2--col3
    1-----a-------x
    2-----b------y
    3-----c------z
    I 'll populate the lov of field A with values in col1. when user selects value 1 in field A. automatically field B should show value 'a'. If user selects value 2 in field A, field B should show value 'b' so on.
    Thanks
    Sunny

  • Can I populate a text field in one PDF with the modification date of a different file ?

    Rather convoluted problem here but I'm trying to place a text field on a PDF document that serves as the main menu page for a library of interlinked PDF documents
    The complete library contains over 7,000 files and additions are added and documents changed almost daily.
    We currently use batch files to open the main menu from it's shortcut and this runs a check on a sync log file (.txt) to ascertain when the last time the user synchronised with the server to get the latest copy of the files.
    Between a certain time range they are told how long it has been since they sync'ed and are offered the option to sync before opening, after a prescribed timeframe they cannot enter without synchronising. We use Allways Sync to conduct the file synchronisation with our mother files on our server.
    What I'd like to do is take advantage of Allways Syncs automatic synchronisation options to synchronise on log on and at prescribed idle periods there after.
    This works fine but I'd like the text field on the main menu PDF to say when the last synchronisation took place - easy if the main menu is the last file modified .. just use info.modDate.
    However, the main menu is rarely modified therefore I wish to import the text to populate the text field from a different file.. either by interrogating the other files modifictaion data (though I doubt Acrobat can do this) or by simply importing some text stored in another file (a .txt file?) which has previously been created by batch file commands.
    Any assistance would be greatly appreciated.
    Regards,
    Nifty Styles
    (Norfolk, England)
    P.S.  I'm using Acrobat 8.3.1. Professional on Windows XP (SP3).

    Thank you for all your help above.
    Just to confirm your advice, am I right with the following conclusions? :
    1. The script (function) to fill the text field with the modification date of a different PDF file needs to be stored in a folder level .js file.
    2. The document containing the text field needs to call the .js function either within the document script or within the custom script property of the text field itself.
    Further to that can you just advise on the syntax for accessing the modification date of the other document.
    Do I need to assign a variable to the address of the file to be used, and then use this variable in the text form filling script (as below) or can I use a direct file reference at the .modDate command.
    var LastSync = "C:\sync\bin\lastsync.pdf";
    var strMsg = util.printd("h:MM tt",LastSync.modDate) + " on ";
    strMsg += util.printd("dddd, d mmmm, yyyy",LastSync.modDate);
    this.getField("LastSyncDate").value = strMsg;
    If the syntax is totally different to the above I would be very grateful for some guidance in the right direction.
    I much appreciate your time to help me ... I'm almost there.
    Kind Regards,
    Nifty

  • Limit the amount of characters of a text field based on first digit

    Hello and thanks in advance for your help!
    I would like to limit the amount of characters of the text field based on the first digit of the number (the text field is only limited to a number format...no decimals, no commas).
    For example, if the number begins with a 3, I would like to limit the text field to allow only ten characters. I have three scenarios but if I could get started with some code and what is the best place to add it (keystroke or validation?) I can take it from there. Thanks again for your help!!

    I've written this code for you that does that. Use it as the field's custom Keystroke code:
    // Validate that only digits are entered
    if (event.change) {
        event.rc = /^\d+$/.test(event.change);
    // Validate string length if it starts with 3
    if (/^3/.test(AFMergeChange(event))) {
        event.rc = AFMergeChange(event).length <= 10;
        if (!event.rc) app.alert("If the number starts with \"3\" it may not be longer than 10 digits.",1); // optional error message
    You can duplicate the second part of it for additional conditions, but keep in mind that this code won't even let you remove the first character in the field if the result is an invalid one.
    For example, if you enter "234567890123456" then you can't remove the "2" at the start because that would result in an invalid number. You can remove any of the other digits, though, and when it's 10 digits or less then you could remove the starting "2" as well.

  • Auto-populating text fields based on dropdown option

    This has probably been covered on this forum before.  I would like to auto-populate multiple text fields with pre-programmed data based on a user-selected option from a drop-down list.  The file here should explain clearly what I want to do:
    https://acrobat.com/#d=ID7ezZN5ZzIKgVvmgkyMiw
    Where can I find an example code that would accomplish this task?  Thanks.
    -Paul

    Your form data hierarchy is different than mine. You need the brackets also, otherwisethe first assignment statements executes only.
    // form1.#subform[0].DropDownList1::exit - (JavaScript, client)
    if (!(this.isNull)) {
      var char = this.rawValue;
      TextField41.rawValue = "Data " + char + "1";
      TextField42.rawValue = "Data " + char + "2";
      TextField43.rawValue = "Data " + char + "3";
    Steve

  • How to populate the TEXT field in MIGO

    Hi folks,
    While creating material document in MIGO or MB01, i am inserting some data in TEXT ( Field in line item level ). This text data is disappearing , once mat doc is created.
    how to populate the TEXT field in MIGO?Is there any cusomisation?it's urgent .
    Regards
    pabi

    Hello Pabitra,
    I had a similar issue in my Project.
    Please verify if the SMOD enhancement MBCF0002 (EXIT_SAPMM07M_001) is active in your system.
    If this is the case, verify from two angles:
    a) Whether the Enhancement was accidentally activated - If yes, then De-activate the same
    b) If there is some logic coded in the User Exit, but, the Text is somehow not determined...even the existing content in the text field (input to EXIT_SAPMM07M_001) will get vanished.
    Hope that your problem will be resolved by this.  Pls reward points.
    With Regards
    Vijay Gajavalli

  • Script To Update Month Text Field?

    Hello SharePoint Fam,
    I am wanting to add a choice field to existing list that contains each month(jan,feb,mar,etc) but was wondering is it possible for me to automate this at all so I don't have to manually change default month value to correct month on the first of each month.
     Basically want the field to be hidden and index it so that I can make a easy filter option for a very big list(60k items) and want it totally invisible to users so all they have to do is load there files and have no idea that a month is being tagged
    to there files.
    Thanks N Advance

    You can use an event receiver (ItemAdded/ItemUpdated) to populate the month field based on any condition (like created date, modified date etc). Or you can also create a Calculated field like (MONTH([Created]).
    Moreover, the field can be set so that it is not visible in forms like NewForm, EditForm, or DisplayForm. Example of setting the field in forms
    SPField.ShowInNewForm = false;
    SPField.ShowInEditForm = false;
    SPField.ShowInDisplayForm = false;
    Blog | SharePoint Learnings CodePlex Tools |
    Export Version History To Excel |
    Autocomplete Lookup Field

  • Populate a text filed based on LOV selection with AJAX

    Good day,
    I would like to populate a text box based on selection from a LOV. If someone selects a LOV value and then tabs off off of that element, I would like
    the text box populated from a sql statement based on the LOV value in the predicate.
    Application Express 4.1.1.00.23
    Thanks for any guidance.
    Steve

    Hi Steve,
    You can do that with an dynamic action which triggers on a "onchange" from the LOV.
    Regards,
    Kees Vlek
    <tt>Company: http://www.orcado.nl
    Blog: http://www.orcado.nl/blog/blogger/listings/69-kvlek
    Twitter: http://www.twitter.com/skier66</tt>
    If the question is answered please change it to answered and mark the appropriate post as correct/helpfull.

  • How to blur a text field populated by a date picker

    Hello,
    I have a text field, it is displayed as a date picker.
    The date picker can populate the said text field as normal.
    However, I have a onBlur="javascript:func" for this text field.
    When the date picker has populated or changed the
    text field, the JavaScript function is not called.
    How can I call the JavaScript function after date picker window closes?
    Or, is it possible to modify
    wwv_flow_utilities.SHOW_AS_POPUP_CALENDAR procedure?
    I do not want to submit the page.
    My JavaScript function uses Ajax to save the text in the text field.
    Thanks in advance!
    Message was edited by:
    mzshen

    vdesign is correct. If you look at the javascript for the date picker it is specifically looking for onChange so that if one exists it will call it. I believe this is the only attribute that can be added by default to a date picker....(i found this out cause I had to build a custom date picker that let the user pick months, but had to look and function just like the delivered one)

  • Populate a drop down list with data from Excel and fill in a text field, based on drop down selectio

    Hi!
    I have a problem with a PDF form: There's a drop down list that I populate with Excel data that I've put in an XML file through an XSD file -- no problem here. The drop down list has a data binding to the XML file, so that a choice in the drop down list can be associated with an object in the XML file. So, when I make a choice in the drop down list, a corresponding object value is fetched from the XML file and put in a text field on the form.
    How to do this is described by Stefan Cameron here:
    http://forms.stefcameron.com/2006/07/29/dynamic-properties/
    There's a snag, though, and to describe it more clearly:
    The XML file contains three types of objects: role, role number, and role cost center. Of these I use the first and the third, i.e. the role and the role cost center. The drop down list contains the roles, and when I select a role, the corresponding cost center is filled out in the text field. So far, so good!
    But -- if the cost center has the same value for two or more roles, all of these roles "bounce back" into the drop down list, that is, they are all selected in the drop down list. How many of these you can see depend on the height of the drop down list -- if it's low you'll only see the first one.
    If I modify Stefan Cameron's data in his example I get the same behavior, so the problem seems to have to do with how XML data are fetched.
    I'm sure there's a workaround, but I can't find it! I've spent many hours browsing the web without finding anyone with a similar problem.
    Any suggestions appreciated!

    Although your issue is far beyond mine, I was hoping you can help me out.....
    I need to create a drop down list of names which I wish to somehow link to an Excel spreadsheet.
    Please let me know the steps I need to do.  I've tried several things, but nothing seems to work and I'm not sure what I am doing wrong.
    Thank you

  • Populate one text field on a form based on the value in another

    I am new to APEX and building my first application.
    When a user enters a value in one field, I would like to run a SQL command and then display a value in another field based on the value in the first field. For instance, if a user enters a part number in one field, when they tab off of the field, I would like to display the name of the part in the part name field.
    Thanks

    Thanks. That put me on the right track. I used that link to find the link http://htmldb.oracle.com/pls/otn/f?p=11933:11:2890374750690437 and then using the two was able to put together a solution.
    I am down to one last issue. I am able to return the name back from the process and display it with an alert statement. Unfortunately, I am unable to display the value on the form.
    I am doing the following.
    <script language="JavaScript1.1" type="text/javascript">
    function f_getCustomerName(id)
    var v_id = id;
    var get = new htmldb_Get(null,$v('pFlowId'),'APPLICATION_PROCESS=getCustomerName',$v('pFlowStepId'));
    get.addParam('x01',$v('P2_CUSTOMER_ID'));
    gReturn = get.get();
    get = null;
    gReturn = (!gReturn)?'null':gReturn;
    /* The below do not work
    $s('P2_CUSTOMER_NAME',gReturn);
    document.getElementById('P2_CUSTOMER_NAME').value = gReturn;
    document.getElementById('P2_CUSTOMER_NAME').value = 'TEST';
    alert(document.getElementById('P2_CUSTOMER_NAME').value );
    alert(gReturn);
    //-->
    </script>
    Process: getCustomerName
    declare
    l_customer_id customer.customer_id%type;
    l_customer_name customer.customer_name%type;
    begin
    l_customer_id := to_number(wwv_flow.g_x01);
    select customer_name
    into l_customer_name
    from customer
    where customer_id = l_customer_id;
    htp.p(l_customer_name);
    end;

  • Using radio buttons to populate a text field

    Hi
    This is my first time creating Adobe Forms and my first time using JavaScript as well. One of the questions on my form asks about Ethnicity and I have about 15 choices for which I created radio buttons. I want the user's choice to populate a textfield, but am not sure how to write the code that will do this. Any help would be greatly appreciated. Thanks

    If you set the export value (aka Button Value, Radio Button Choice) of each radio button to the text you want to show up in the text box, the custom calculate script for the text box, which you should set to read-only, can be simply:
    (function () {
        // Get the value of the radio button group, as a string
        var s = getField("Ethnicity").valueAsString;
        // Set this field's value to the text associated with the selected radio button
        event.value = s === "Off" ? "" : s;
    If none of the radio buttons is selected, the text field will be blank. Change "Ethnicity" above to the actial name of the radio button group.

Maybe you are looking for

  • Report execution error in S_ALR_87012043

    Hello Friends, When I execute the report for GL balancees through T.Code: S_ALR_87012043 I get the following error message (Variant SAP&001 of program RFSSLD00 is not   current version) Give me the solution to overcome the above problem in Asset Acco

  • I just bought a router WRT54G and a Compact wireless-G

    i just bought a router WRT54G and a  Compact wireless-G and by the time to connect them it seems that both things work correctly but there are two icons that show if u are connect to the internet, so here is the problem one icon says that my connecti

  • Want to unlock my Nokia 5230

    I was sent a Nokia 5230 from abroad locked to the network over there, my question now is "have they been unlocking it?" Coz i was told by an expert that the file is not yet out. Pls can someone help!

  • MR21 price changes for split valuation materials

    HI I have changed the material price for the material whcih are maintained with split valuation ie. in MR21 i could able to change the price for valuation types only.. i'm not able to change the main material price , its asking to enter the val type?

  • Refreshing the nativeWindow

    Hello, I'm currently developing an application in adobe Air using html and javascript. I noticed that when I had content to my page through javascript, that whatever javascript functions are attached to it don't work until I reload my page. e.g.: 1)