Expand my Community achievements bar.

Drop down list changes choice

Avatar

Former Community Member
I'm having a problem with a script. At the bottom of this form I have a drop down box that's supposed to populate the box located right beneath it but...no go. DFC should populate 'District Attorney' etc...



Hoping fresh eyes can spot my error.



- Jim



http://dl.getdropbox.com/u/46315/PCAS.pdf
7 Replies

Avatar

Former Community Member
Remove the script in the change event of the Name field and move the logic from the exit event of Name to the calculate event of the Title field.



Add one more case condition to test for a blank Name, or else Title will evaluate to "0".



That should work.

Avatar

Former Community Member
hi,

just for clarification, you need to populate the title textfield based on the value selected in Name dropdownlist right.



Instead of specifying the values in exit event of textbox .. try the below code in the change even on Name (Dropdownlist)



var myval;

myval = xfa.event.newText;



switch (myval)

{

case 'DFC':

Title.rawValue = "District Attorney";

break;



case 'PJC':

Title.rawValue = "First Assistant District Attorney";

break;



case 'JMM':

Title.rawValue = "Second Assistant District Attorney";

break;



case 'JAP':

Title.rawValue = "Assistant District Attorney";

break;



}



whenever you select a value in Dropdown list the Title textbox will not be populated.



try and see.



Vidya

Avatar

Former Community Member
Thank you both for your assistance, but neither suggestion worked. I've added a piece of a previous form that works the way I want the new one to work but I can't find the discrepancy.



http://dl.getdropbox.com/u/46315/PCAS.pdf

Avatar

Former Community Member
Oh, you're going to hate this.... :)



Vidya's response above had it right.



The example in your new form (the one that works) works because it's posting numbers to Mileage.



Your titles aren't working, because they're strings and need to be quoted. (I think with 'single quotes'). Yep, that worked for me.



Good luck with the project.



- Dave

Avatar

Former Community Member
Aha, that got it working. Needed "" not ''.



But now onto the next problem. I want to be able to choose a Company from a drop down list and have their address inputted in a box below with separate multiple lines. Any idea how I can script that? This is what I have working so far. Can I add more lines to address.rawValue?



case 'Verizon':

address.rawValue = "Legal Compliance";

faxNumber.rawValue = "xxx-xxx-xxxx";

break;

Avatar

Former Community Member
Wow....google actually worked for me this time. All I needed was \n after each address line!