Hi,
I'm having trouble trying to add conditions together.
I have a form that has so many dropdowns with the same 1-5 options. However, a user must not choose the same option in any two or more different drop downs. e.g. if dropdown 1 has an option of "1" then dropdown 2 must have a different option, dropdown 3 must have a different option etc.
I cant seem to get my script running properly. I need to combine statements.
Can someone be of any help please?
My script for the first dropdown is:
if (this.rawValue = Drop2.rawValue)
{
xfa.host.messageBox("You cannot have duplicate positions for different financial threats/risks/hazards. Please choose another position!");
}else if (this.rawValue = Drop3.rawValue){
xfa.host.messageBox("You cannot have duplicate positions for different financial threats/risks/hazards. Please choose another position!");
}else if (this.rawValue = Drop4.rawValue){
xfa.host.messageBox("You cannot have duplicate positions for different financial threats/risks/hazards. Please choose another position!");
}else if (this.rawValue = Drop5.rawValue){
xfa.host.messageBox("You cannot have duplicate positions for different financial threats/risks/hazards. Please choose another position!");
}
else if (this.rawValue == 1 && this.rawValue != Drop2.rawValue && this.rawValue != Drop3.rawValue && this.rawValue != Drop4.rawValue && this.rawValue != Drop5.rawValue){
FINANCIAL_1_1.rawValue = FINANCIAL_1.rawValue;
} else if (this.rawValue == 2){
FINANCIAL_1_2.rawValue = FINANCIAL_1.rawValue;
} else if (this.rawValue == 3){
FINANCIAL_1_3.rawValue = FINANCIAL_1.rawValue;
}
it just doesnt seem to work.
Solved! Go to Solution.
Views
Replies
Total Likes
Send the form to stwalker.adobe@gmail.com and I can take a look.
Steve
Views
Replies
Total Likes
How about this....
I have five drop-down lists ('dd1' thru 'dd5'). The exit event on each drop-down is the same, as depicted by the exit event on 'dd1' below.
// form1.page1.subform1.dd1::exit - (JavaScript, client)
if (!(this.isNull)) {
myScriptObject.validateDropDowns();
}
The exit event calls validateDropDowns() on the script object 'myScriptObject'. The functions is as follows:
// form1.#variables[0].myScriptObject - (JavaScript, client)
function validateDropDowns() {
var dd1 = form1.page1.subform1.dd1.rawValue;
var dd2 = form1.page1.subform1.dd2.rawValue;
var dd3 = form1.page1.subform1.dd3.rawValue;
var dd4 = form1.page1.subform1.dd4.rawValue;
var dd5 = form1.page1.subform1.dd5.rawValue;
var ddArray = new Array(dd1,dd2,dd3,dd4,dd5);
ddArray.sort();
var last = "";
for (var i=0; i < ddArray.length; i++) {
if (i == 0) {
last = ddArray[i];
}
else {
if (ddArray[i] != null) {
if (ddArray[i] == last) {
xfa.host.messageBox("This option was previously selected.");
i = ddArray.length;
}
else {
last = ddArray[i];
}
}
}
}
}
thanks Steve,
It works. This means the first part of my dropdown function is sorted.
However, for the second part, I'd like to have a text box where the rawValue of the dropdown option reflects.
e.g.
after an option in dd1 is picked, the rawValue for dd1 is transfered to a readonly textbox.
I've tried adding the following script after the validation script in the exit event of the dd1 but its not working.
if(this.rawValue == 1){
this.rawValue = FINANCIAL_1_1.rawValue;
} else if (this.rawValue == 2){
this.rawValue = FINANCIAL_1_2.rawValue;
} else if (this.rawValue == 3){
this.rawValue = FINANCIAL_1_3.rawValue;
}
I would have loved to attach my form to this thread but I do not have an option for that.
Also, after validating with 'myScriptObject' can we add a script to return the dropdown value to the default 'null'?
Thanks again for your reply.
Views
Replies
Total Likes
Send the form to stwalker.adobe@gmail.com and I can take a look.
Steve
Views
Replies
Total Likes
thanks. sent it.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies