on 04-07-2011 10:52 AM
Hi all
I am creating an Adobe interactive form .
I am applying setfocus() on multiple fields.
But my code for this method is creating problem when this is applied to the two dropdowns one after the other.
The problem is that when one leaves the first dropdown blank and enters into the other dropdown(setfocus applied on this also)
the error message pops out for the first ,and it pulls the cursor back to the first dropdown.
But as second dropdown is also mandatory and is blank at that time it will show warning for that also.
So in this manner my form is getting into unavoidable loop.
So please help me to solve this issue.
Thanks
Ravi Pawar
Ah I got you. So setfocus AFTER the error/check occurs.
So it sounds like you could make your checks truly independent....ie....
if dropdown 1 = blank, error and setFocus dropdown 1
if dropdown 2 = blank and NOT (dropdown 1 = blank and dropdown 1 has focus), error and setFocus dropdown 2.
Right?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm not going to provide you the exact code. Sorry. You would cut-n-paste it and not learn....also, I don't know the details for your form, so I can't actually give you the code. I was simply trying to explain the logic you "might" want to use in your own code in order to make the dropdowns work as you want them with the information you provided. Just try to work out the code....you can always post it back and we can work it out with you until you get it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Some sample code using java script
if ( <condition> )
this.getField("Fieldname").setFocus();
You just need to change <condition> to check if correspond field is empty, and which "Fieldname" to focus.
You need to make sure this code is running at the right event as well. Good luck and hope this help.
regards,
Xiang Li
Edited by: xiangli heah on Apr 12, 2011 12:02 PM
Thanks Xiang Li for your reply.
I applied the script but this is not working . I applied the condition also that I was using in my previous code which is-
if (Page1.Subform1.FIELDNAME.isNull) {
xfa.host.setFocus(Page1.Subform1.FIELDNAME);
xfa.host.messageBox("Last name is a required field.","Required Field",1);
}
The above mentioned code is for exit event in Live cycle designer . It is working for the text field but this is not working for the dropdown as intended.
Following is the code which i applied after making relevant changes in your given code-
if (Page1.Subform1.FIELDNAME.isNull) {
this.getField("Page1.Subform1.FIELDNAME").setFocus();
}
The second code is not working..
So in the first case i am getting struck in loop for two dropdowns(on which same code is applied to make them mandatory).
So correct me if i am wrong in my approach.
@ Chris.. if you are also following this problem now please help me as now i have provided the code which i have been working on.So, please help me to solve this issue..
Edited by: ravipanwar.21 on Apr 13, 2011 6:55 AM
Edited by: ravipanwar.21 on Apr 13, 2011 6:56 AM
Edited by: ravipanwar.21 on Apr 13, 2011 6:56 AM
Why are you "forcing" a setfocus? I am trying to follow you.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.