Hi there,
I am making message box in formCalc and I would like to set the focus back to the field when the user choose ”yes” .
form1.#subform[0].TextField1::exit - (FormCalc, client)
if(xfa.host.messageBox("Do you want to change the field value?", "Warning", 2, 2)=="4")then
xfa.host.setFocus($)
endif
I can make the function work in JavaScript but not in FormCalc. Can some tell me whats wrong?
It has to be FormCalc as the message box will pop up at the end of a long complex calculation that I didn’t make. And I don’t have the qualifications (or the time) to change that script to JavaScript.
Kirstine
Solved! Go to Solution.
Views
Replies
Total Likes
The field name has to be in quotes....
xfa.host.messageBox("TextField1")
Paul
Views
Replies
Total Likes
I assume that you are executing this code on the exit event of the field. If so, then when you exit the field the $ that you are using to refer to the current field is no longer valid. In fact the focus is now the next field so the $ refers to that. Replace the $ with the name of the field that you were on and it should work fine.
Paul
Views
Replies
Total Likes
Hi Paul,
I followed your advise but it doesn’t seem to change anything. And yes I am on the exit event.
form1.#subform[0].TextField1::exit - (FormCalc, client)
if(xfa.host.messageBox("Do you want to change the field value?", "Warning", 2, 2)=="4")then
xfa.host.setFocus(TextField1)
endif
Kirstine
Views
Replies
Total Likes
The field name has to be in quotes....
xfa.host.messageBox("TextField1")
Paul
Views
Replies
Total Likes
Hi,
this should work.
if ($host.messageBox("Do you want to change the field value?", "Warning", 2, 2) eq "4") then
$host.setFocus($.somExpression)
endif
Paul,
Such a little thing and yet so importent. It works.
Radzmar
I like your script because I don’t have to referre to my field by its exact name. (I may change the name of the field and forget all about the script)
Thanks to both of you.
Kirstine
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies