Is "conatact:" correct?
In the SetFieldValues() function, the target field name is hard coded. This needs to be set differently for each dropdown, because they each set a different text field.
There are a couple of ways to do this.
1. Include the target field name as a function input
2. Automatically generate the target field name from the name of the current field.
I like #2 best because it reduces the amount of work I have to do. but it requires the fields and named in a consistent fashion that lends itself to this process. For example "DropDown1" goes to "TextField1".
no sorry just a typo couldn't copy and paste the script so I re typed some of it.
I'm not the best at script but I think I understand. is there any way you could give me an example of how to write that in code?
The easy method is to just include the name in the code
Here is a redo of your set function
function SetFieldValues(cDeptName, cTargetField)
this.getField(cTargetField).value = DeptData[cDeptName].contact;
Now you're Commit (keystroke) script on the dropdown should include something like this
Of course the "TextField1" needs to actually be the name of the target field on your form.
Alright so I am still able to do just about the same thing and still getting stuck.
Imagine I have a 6 fields on the left and 6 fields on the right. All drop down lists on the left are named AppAuth1, AppAuth2, etc.. All the way to 6. Then in the same format on the right named DeptContact1, ... all the way to DeptContact6. no matter how I play with the code I can always get the first dropdown list to produce the correct information into the DeptContact1 field. Now when I try to alter the code for AppAuth2 to equal DeptContact2 and so forth all the way down it never works. I have no idea how to proceed. is there any way to show me how this would look in code? as for the custom Keystroke script I am using the following code below.
if(event.value == " ")
else SetFieldValues(event.value, "DeptContact1");
Get rid of the the resetForm line.
What are the curly braces for? is there more code?
Change it to this for the the AppAuth2 dropdown
if(event.value != " ")
Did you change the SetFieldValues Function? And delete any previous versions of it?
Have you looked in the Console Window for Errors? Please do this before posting again.
Here is a video on using the Console:
I figured it out.... see below if anyone else ever has this issue.
event.value = this.getField ("dropbox1").value;
You say you put this in the Format event? Or do you mean the Keystroke event.
So the first line of code does nothing. It sets the appearance value of the drop-down to its own value.
The second line only has meaning for a keystroke event, which is what you must be talking about since you're using the event.changeEx property which only has value in the Keystroke event.
So what you are saying is that you hand coded each field to do what I was telling you to do in the previous posts.
For other people read this, do not use the code posted by jonathanc1246, this is not the right way to go.
I'm not sure you picked up on this but I do not write code for a living... I had a task that needed completing so I reached out on this forum hoping for a solution to the problem I had. Please do not take your inability to explain in a helpful way as any kind of insult to your intelligence. I literally scoured the internet for a solution to my problem. In my mind if it works then there is no "wrong" way to go. Maybe you should make another video just for the purpose of explaining why my solution to the problem is not the right way to go and I would happily watch it. I love to learn and to help others so when you respond to the next person to try and help please keep in mind that their working knowledge is probably not at your level hence the reason they are reaching out for assistance.