Auto-fill text box field values based on pulldown selection

Trying to fill in address, city, state, zip text fields based on option selected in a select form field. The following code works great in Internet Explorer, but in Chrome or Firefox, after making selection, text fields are populated with the word "undefined."
I've found a PHP version of Jquery script here that would probabably fit the bill.
http://stackoverflow.com/questions/3657127/jquery-populate-text-input-from-table-based-on- select-value
Maybe someone has a CF version they could share?
Thanks in advance to any who can point me to a solution for this code, or a better way to accomplish my need.
<!--- Destinations with auto-fill of address, city, etc. --->
<script type="text/javascript">
      function selectAddress(list) {
            // assume first item is empty
            if (list.selectedIndex > 0) {
                  var locationID = list.options[list.selectedIndex].value;
                  var locationAddress = 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>
<tr>
<td align="right" bgcolor="#FFFFFF" valign="top">Name of Destination</td>
<td align="left" bgcolor="#FFFFFF" valign="top">
   <select name="locationID" onChange="selectAddress(this)" class="smallforms">
             <option value="">SELECT DESTINATION ››››››››››</option>
             <cfoutput query="allLocations">
                   <option value="#locationName#" locationAddress="#allLocations.locationAddress#" locationCity="#allLocations.locationCity#" locationState="#allLocations.locationState#" locationZip="#allLocations.locationZip#">#locationName#</option>
             </cfoutput>
        </select> 
      Other: <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"> 
         Zip:       <input class="smallforms" id="locationZip"       name="locationZip"       type="text" size="8"><br />
<br />
</td></tr>

Thanks a million for the help Steve, the array is being created in source as follows: 
<script type="text/javascript">
var addresses = [
   "locationName": "Airport Park School",
   "locationAddress": "",
   "locationCity": "",
   "locationState": "WI",
   "locationZip": ""
   "locationName": "American Legion Golf Course",
   "locationAddress": "1001 Golf Club Road",
   "locationCity": "Wausau",
   "locationState": "WI",
   "locationZip": "54403"
but I'm lost at the
// reference as address[index].locationName...address[index].locationZip where index = 0-[arraysize-1]
direction, and just to double check, you named the Javascript var "addresses", so the "reference as address" s/b "reference as addresses" right?
I've tried many iterations of "onchange" adding other variables (locationCity, locationZip, etc.) but coming up empty.
Anyway, I wish I could buy you a beer or two for the help . . .
Here's where I'm at, which ain't working. If you have a minute to look over, it would be MUCH appreciated. Try not to laugh at my (what's probably ugly) Javascript code:
<!--- Code from Steve @ Adobe.com CF Forum --->
<script type="text/javascript">
var addresses = [
<cfset variables.fs = "" />
<cfoutput query="allLocations">
  #variables.fs#{
   "locationName": "#jsStringFormat(locationName)#",
   "locationAddress": "#jsStringFormat(locationAddress)#",
   "locationCity": "#jsStringFormat(locationCity)#",
   "locationState": "#jsStringFormat(locationState)#",
   "locationZip": "#jsStringFormat(locationZip)#"
  <cfset variables.fs = "," />
</cfoutput>
// reference as address[index].locationName...address[index].locationZip where index = 0-[arraysize-1]
</script>
<tr>
<td align="right" bgcolor="#FFFFFF" valign="top">Name of Destination</td>
<td align="left" bgcolor="#FFFFFF" valign="top">
  <select name="locationID" class="smallforms"
  onChange="var locationAddress = addresses[list.selectedIndex].locationAddress;">
             <option value="">SELECT DESTINATION &#8250;&#8250;&#8250;&#8250;&#8250;&#8250;&#8250;&#8250;&#8250;&#8250;</option>
             <cfoutput query="allLocations">
                   <option value="#locationName#">#locationName#</option>
             </cfoutput>
      </select> 
  Other: <cfinput name="destinationNameOther" type="text" class="smallforms" size="75">
  <br />
  <cfoutput>
   <input id="locationID" name="locationID" type="hidden"><br>
   Address:  <cfinput class="smallforms" id="locationAddress"  name="locationAddress"  type="text" size="30"> 
   City:   <cfinput class="smallforms" id="locationCity"   name="locationCity"  type="text" size="20"> 
   State:   <cfinput class="smallforms" id="locationState"   name="locationState"  type="text" size="2"> 
   Zip:   <cfinput class="smallforms" id="locationZip"   name="locationZip"   type="text" size="8"><br />
  </cfoutput>
<br />
</td></tr>
Thanks again Steve . . . much appreciated!

Similar Messages

  • Concatenate text to field value in report header

    I'm trying to concatenate text to field value in a textbox in the report header but am getting an error.  Here's how I'm doing it:
    =First(Fields!Pp_Name.Value, "dsProspect") & "Prospect"
    and the error says the report definition is invalid.  An unexpected error occurred while compiling expressions.  Native compiler return value '[BC30179] class 'Textbox.....
    any idea why this wont compile?
    Thank you.

    Hi moondaddy,
    Generally, the error message always occurred when there are two distinct text boxes with the same name that only differ in their name by casing in report. When Reporting Services generates VB code for these textboxes during report publishing, the compilation
    fails because VB class names are considered case-insensitive.
    So this issue is not related to the expression (the format is correct) you post, it related to the Textbox name that the error message said. In order to fix this issue, please rename one of the textboxes.
    If there are any other questions, please feel free to ask.
    Thanks,
    Katherine Xiong
    If you have any feedback on our support, please click here.
    Katherine Xiong
    TechNet Community Support

  • How to Handle Blank Field Value based Condition in SmartForms

    Dear Sir,
    In SMARTFORM , we need to define a Condition that incase Field Value is not equal to  BLANK value (blank means that field is empty) then a specific text gets printed .
    Our problem is that  We do not know as how to define  Empty Field Value  based condition .
    Had it been Non Empty Field value based condition then solution was simple and could be done in following way :
    Field Value                        R                     Comparision Value
    WA_KZDKZ                      =                      'X'
    In our case , we need to give Blank (Empty Value) instead of 'X' .
    Kindly help us pl .
    Rgds
    B Mittal

    Hi,
    To handle blank field values in SMARTFORMS,
    Go to the conditions tab in your SMARTFORM and give condition there
    Field                Comparision operator          value
    <Field name>      <> Here symbol is diff     space.
    eg:
    wa_mara-matnr    =/                                   space.
    Regards,
    Santosh Kumar M.

  • Why can't I create a document in my Facebook group on my iPad? It won't let me input any text into the text box field after I create a new document. Thanks.

    Why can't I create a document in my Facebook group on my iPad. It won't let me input any text into the text box field after I create a new document. Thanks.

    Just thought I'd add my solution, I decided to go with WebDAV and I think it actually works better than the iTunes way, the steps are pretty much the same but avoiding the iTunes interface just makes things easier and faster.
    I followed this guide but it does have a small mistake in the httpd-dav.conf file, on line 2, where it's WebServer/WebDAV">, it should be <Directory "/Library/WebServer/WebDAV">.
    The tricky part is setting permissions which if wrong will give you errors when connecting with the iPad, I opted to set all to Read&Write since my home network has a hardware firewall. Another convenience was to add an alias to the webdav share on the Desktop.
    I'm still expecting the call from Apple but even if they fix the iTunes I'm sticking with WebDAV, atleast until I see what's new with iOS5 and iCloud this fall which should bring true sync for documents (I'm hoping that they will offer encryption with my own keys, if not, then I'll probably keep using WebDAV).

  • SharePoint 2010 list view - How to filter on a multiline text box field - the view filter does not allow me to select it.

    Hi there,
    Does someone know in SharePoint 2010 list view - How to filter on a multiline text box field - the view filter does not allow me to select it.
    Thanks,

    Hi,
    Per my knowledge,
    it is by design that the data type multiple lines of text can only use “contains” and “begins with” operators.
    You can also filter the list view using SharePoint Designer,
    Open your list AllItem.aspx page in SPD ->click “Filter” > in “Field Name” select your multipe line of text field, in “Comparison” will displayed four choices.
    Best Regards,
    Lisa Chen
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • How to create Auto complete text box in share point 2010 Visual web part

    Hi All ,
    I am want to use Auto complete text box in share point 2010 Visual web part ,data need to get from share point list how to  create 
    please guide me how to use Auto complete text box
    Thanking you,
    Arun Darly

    Hi Arun,
    Please refer to the following article.
    SharePoint 2010: JQuery Autocomplete Textbox Containing List Items
    http://smarttools.codeplex.com/wikipage?title=Autocomplete%20Text%20Field
    Please don't forget to mark it as answered, if your problem resolved or helpful.

  • Can you mask a field value based on another?

    In XML publisher, is it possible to not display field values based on a value from another field?  If so, how can this be accomplished?
    For example, I have a field value for Address Line 1 as "123 Main Street".  I don't want the City, State, Zip, County and Country to be be displayed in the pdf output.  However, all other Address Line 1 values should be displayed.
    Thanks in advance,
    -joe

    PLD is a very basic tool.  The goal you try to achieve may not be available as I know of.
    Thanks,
    Gordon

  • How to display value based on LOV selection

    Hi,
    I have an editable table. On create operation one of the field is LOV, based on LOV selection the next field should be auto populated, please help me how to achive this.
    Thanks,

    Thanks for your reply........
    I did all these to get value based on LOV selection, but my problem is when i am trying to create a new record then everthing is working fine but normal search i am not getting the value of that attribute.
    below is my code
    Page:
    <af:column sortProperty="ProcessType" filterable="true"
    sortable="true"
    headerText="#{bindings.CmWeeklyProcesses.hints.ProcessType.label}"
    id="c36" width="340px;">
    <af:inputComboboxListOfValues id="processTypeId"
    popupTitle="Search and Select: #{bindings.CmWeeklyProcesses.hints.ProcessType.label}"
    value="#{row.bindings.ProcessType.inputValue}"
    model="#{row.bindings.ProcessType.listOfValuesModel}"
    required="#{bindings.CmWeeklyProcesses.hints.ProcessType.mandatory}"
    columns="#{bindings.CmWeeklyProcesses.hints.ProcessType.displayWidth}"
    shortDesc="#{bindings.CmWeeklyProcesses.hints.ProcessType.tooltip}" inlineStyle="width:800px;"
    valueChangeListener="#{backingBeanScope.backing_app_CalcSchedules.weeklyDescription}"
    autoSubmit="true" >
    <!-- <f:validator binding="#{row.bindings.ProcessType.validator}"/>-->
    </af:inputComboboxListOfValues>
    </af:column>
    <!--value="#{row.bindings.Description.inputValue}" backingBeanScope.backing_app_CalcSchedules.description-->//If i use this value in the below property line then i am not getting value while creating time but if i done blind search then i am not getting any value in this field.
    <af:column sortProperty="Description" filterable="true"
    sortable="true"
    headerText="#{bindings.CmWeeklyProcesses.hints.Description.label}"
    id="c35" width="390px;">
    <af:inputComboboxListOfValues id="descriptionId"
    popupTitle="Search and Select: #{bindings.CmWeeklyProcesses.hints.Description.label}"
    value="#{row.bindings.Description.inputValue}"
    model="#{row.bindings.Description.listOfValuesModel}"
    required="#{bindings.CmWeeklyProcesses.hints.Description.mandatory}"
    columns="#{bindings.CmWeeklyProcesses.hints.Description.displayWidth}"
    shortDesc="#{bindings.CmWeeklyProcesses.hints.Description.tooltip}" inlineStyle="width:1000px;"
    readOnly="true" partialTriggers="processTypeId">
    <f:validator binding="#{row.bindings.Description.validator}"/>
    </af:inputComboboxListOfValues>
    </af:column>

  • Form Personalization - Make field required based on LOV selection

    Newbie here.
    I am trying to make a field required based on the selection of the LOV that is next to it. Having a heck of a time with it.
    The form i am working on is the Sub Invenntory form that you get to via Organization Items. We want the subinvnetory field to be manditory when subinv is selected from the LOV in the sources tab.
    here is what i have so far:
    CONDITION
    Trigger Event: WHEN-VALIDATE-RECORD
    Trigger Obj: ITEM_SUBINVENTORIES
    Condition: ${item.item_subinventories.SOURCE_TYPE.value} = 3
    Action
    Type: Property
    Object Type: Item
    Target Object: ITEM_SUBINVENTORIES.SOURCE_SUBINVENTORY
    Property Name: REQUIRED
    Value: TRUE
    The problem seems to be that i can't get the field to be required. It shows up yellow but still allows me to save w/ the field being blank.

    I do not know about the particular form that you are trying to personalize, but whenever I have created a condition, it has usually been in the following syntax:
    :BLOCK_NAME.FIELD_NAME = 'VALUE'
    For example, :MTL_SYSTEM_ITEMS.PRIMARY_UNIT_OF_MEASURE_MIR = 'SEAT'
    Yours seems to be very much different from mine, but then again, I am not technical so I cannot comment intelligently on that aspect.
    May be that is the problem.
    Also, once you get it to work, you might want to also add a condition where the field is turned to un-required when the SOURCE_TYPE is NOT 3.

  • How can we read the screen field values from the report selection screen wi

    Hi expart,
    How can we read the screen field values from the report selection screen with out having an ENTER button pressed  .
    Regards
    Razz

    use this code...
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_posnr.
    **Read the Values of the SCREEN FIELDs
    CALL FUNCTION 'DYNP_VALUES_READ'

  • How do I auto fill a date field for an Adobe form?

    Hi. I am new to Acrobat. I would like to have Acrobat auto fill today's date in a date field when I open an acrobat form. I check the forum help and it indicated that I associate this javascript text to the field:
    var f = this.getField("Today"); if (f.valueAsString=="") f.value = util.printd("mm/dd/yyyy", new Date());
    However, when I try it out, nothing happens.
    Any clue as to what I am doing wrong?
    - Michael

    Hi M. Krebs,
    Is there a text field in the PDF labeled "Today" and set as a date field? And does the Date Options format set for the field match what is in the JavaScript (mm/dd/yyyy)?
    Best,
    Sara

  • Auto-filling every box in tiger

    Help!
    I just turned on my ibook this morning and it was auto-filling the login password box and will not allow me to type anything in on my own. I tried to put the tiger install disc in but will not allow me to enter my password to install on my own so I am out of ideas. I am on a PC right now Can someone please help me figure this problem out? thanks!

    Each area where you can enter data into a PDF form in the normal view or non-Form Editing view is a field object. Each one of these fields has a name to identify that area or object form other form fields. If the names are the same the fields then those specific fields share many of the same values, the most important is the value of the field.
    This is an issue that needs to be addressed by the form's creator.

  • Populate text in field 1 based on calculation in another field

    Hello,
    Currently, I have a calculated field that is the sum of 7 numeric fields. I then have a text field that I would like to populate based on the calculation.
    For example, if the value in the calculated field (Total) is "27", textfield should read "Great Job". If Total is >27, the textfield should read "Keep Trying".
    I have two questions... What script should I try? and Where should the script reside?
    I have tried to add script in the 'change' section of the Total field, but since the user is not changing this field (it is calculated), the script is not being triggered. I have tried the script in the 'change' section of each of the 7 numeric fields, but am having trouble referencing the Total field value.
    Any help would be appreciated.
    Thanks
    E

    Eric,
    I added 8 Numeric Fields named MonTotal, TueTotal, WedTotal, ThurTotal, FriTotal, SatTotal, SunTotal and WeekTotal.
    I added a FormCalc script to the calculate event of the WeekTotal Numeric Field shown below:
    form1.#subform[0].MonTotal + form1.#subform[0].TueTotal + form1.#subform[0].WedTotal + form1.#subform[0].ThuTotal
    + form1.#subform[0].FriTotal + form1.#subform[0].SatTotal + form1.#subform[0].SunTotal
    Once I saw the calculation was working I inserted a new text field named "Comment" and a standard button (Labeled "Click on Completion" and added a FormCalc script to the click event of the standard button shown below:
    if (form1.#subform[0].WeekTotal == 27) then
    form1.#subform[0].Comment = "Great Job!!!"
    elseif (form1.#subform[0].WeekTotal > 27) then
    form1.#subform[0].Comment = "Keep Trying!!!"
    endif
    Hopefully this is helpful.
    Have a great day!
    Pam

  • How to make form text box field display name or instructions?

    Using form tools, I have added text boxes in my PDF that I would like to have the field name display. So the user would understand what kind of info they need to fill in. For example, [Type organization name here] in one box and [type address] in another. This is not an actual form, so I don't want to put those labels outside the field as shown on the adobe sample form.

    You can add your text to the 'tool tip' for the field's properties, use the right mouse click.

  • Tool Tip Text for field values in ALV report

    Hi,
    How to get the tool tip text for the field values in ALV report.
    Thanks & Regards,
    Pallavi.

    Hi,
    In fieldcatalog specify the TOOLTIP.
    <b>
    LVC_S_FCAT-TOOLTIP
    </b>
    In this speicfyteh tooltip you want.
    Then append this to the fieldcatalog.
    Hope this solves ur problem.

Maybe you are looking for

  • Logout has timed out because the application Mail failed to quit.

    Hello world... (Mac world that is) The message says more "Logout has timed out because the application Mail failed to quit. To try again, quit Mail and choose Log Out from the Apple menu." I tried everything. Still does not let me shut down. Other pr

  • Vendor Invoice Issue

    Dear Experts,            In a PO a down Payment request of 10,00,000/- was created to a vendor, there are 3 invoices for that vendor. Now my question for each Invoice while Passing (MIRO) 3,33,333/- should be deducted from the Bill amount. Please adv

  • Help with SOAP

    Hi there, Hoping to get some help here with an issue I'm stuck on. I'm trying to use the Bing Ads Web service in Python (SUDS) and also just using curl. I'm able to read in the WSDL file and generate the XML/SOAP output.  I feel like there is somethi

  • Structure of a data type(Sender JDBC adapter)

    Hi Experts, I've 5 columns. There's a possibility of getting multiple records at a time. How should my source data type look like? Data type(1..unbounded) .........Column1(1..1) ..........Column2(1..1) ..........Column5 OR Data type ....Rowset(1..unb

  • Copy UI elements between views

    Hi! I hope this will be easy for you, but for me it's unknown yet. I have 5 views within the same WD component, and these views have a section, which supposed to be the same within all 5 views (display some additional data). They are working from a C