Copy link to clipboard
Copied
Is it possible to have more than one export value populate to the same text field depending on what the user chooses?
I have 2 dropdown fields 1)Employee 2)Absence that I've put export values on to populate to a text field named Pay Type.
I added the the JavaScript below to the custom calculation script in PayType which works for one dropdown field, but I'm not sure if you can make it work for both Employee and Absence dropdowns
event.value = this.getField("Employee").value;
Eg. if the user chooses from the Employee dropdown the export value populates to PayType but if they choose from the Absence dropdown I'll need that export value to populate in PayType, but if the user removes the selection from the Absence dropdown I'm hoping it will populate the export value again from the Employee selection?
I'm hoping if it can be done and/or I can figure out how to do the JavaScript it just might help resolve an issue I'm having with my form.
1 Correct answer
I figure it out! I added a custom calculation script in PayType field. I was doing this before but I was going about it a bit wrong. I was populating employees status (reg, temp etc) to PayTypeDesc and then populating everything in the custom calculation to PayType (status,vacation,acting), but I now changed it to populate employee status separately. Now if the user removes a selection from absence or acting the employee status resets back again. I hope that makes sense, but anyways it work
...Copy link to clipboard
Copied
I think this is possible in a variety of ways using JavScript. But personally I avoid using export values with dropdowns. I find it easier to use a simple for loop script in combination with conditional statements to populate another field.
However, if you're in the need of working only with export values then consider using a script for a dependent list box with dependednt list values.
Here's very good script developed by Joel Geraci that I've adopted in my PDFs and it works phenomenally.
It is used as a custom format script. But is tricky and not as simple as it looks . This depends on what you already have.
If you need an example of how I've implemented this script in one of my forms let me know.
There's a little logic behind this script to get the results that you want and still be able to allow the dependednt fields to remain editable by the user if the values change in those dropdown boxes.
Copy link to clipboard
Copied
Thank you so much for the reply! I thought maybe if it was a simple thing I could try to see if it could resolve a minor issue on my forms, but I don't think it will 😞
What I've done works for the most part by 'changing the text field on the drop downs', but I have a few drop downs populating to the same 'PayType' text field. The user chooses thier name from the 'Employee Name' list and their pay status populates to the 'PayType' text field. Then they choose from 'Absence' or 'Acting Rate' list and the paycode populates to the same 'PayType' text field. The problem is if they delete the entry from the absence list or the acting rate their pay status disappears. It would be a huge bonus if I could figure out how to make sure their pay status populates again if they delete their selection on the absence or acting list.
It's not a huge big deal but I'd be happy if can make it better 🙂 If it's too complicated or just can't be done then at least I'll know I have to just let it go.
Copy link to clipboard
Copied
I figure it out! I added a custom calculation script in PayType field. I was doing this before but I was going about it a bit wrong. I was populating employees status (reg, temp etc) to PayTypeDesc and then populating everything in the custom calculation to PayType (status,vacation,acting), but I now changed it to populate employee status separately. Now if the user removes a selection from absence or acting the employee status resets back again. I hope that makes sense, but anyways it works great now, woot! Now my form it bullet proof!
var a ="";
if (this.getField("PayTypeDesc").value == "COT"){
a="200";
} else if (this.getField("PayTypeDesc").value == "Vacation"){
a="100";
} else if (this.getField("PayTypeDesc").value == "Sick"){
a="200";
} else if (this.getField("PayTypeDesc").value == "Acting"){
a="11";
} else if (this.getField("Employee").value == "Sean"){
a="2";
} else if (this.getField("Employee").value == "Tracey"){
a="1";
}
event.value = a;
Copy link to clipboard
Copied
Great!
That is why I prefer to use conditional statements with dropdown menus and avoid using scripts to get the export values... seems to be a lot easier and less prone to problems.

