Hello,
I was wondering if anyone can help me with the correct javascript to use in my form that will jump to a particular control. Basically, when someone clicks a button I want a previously hidden text field to become visible (which I have done), and for the page to 'jump' to that control (which is where I need help).
I would have thought it was something like form1.txtfield.focus() but that doesn't seem to work.
I'd be grateful for any help!
Thanks
Matt
Solved! Go to Solution.
Views
Replies
Total Likes
The code is
xfa.host.setFocus('<your field name>');
e.g xfa.host.setFocus('form1.page.txtUserName1');
Nith
Views
Replies
Total Likes
The code is
xfa.host.setFocus('<your field name>');
e.g xfa.host.setFocus('form1.page.txtUserName1');
Nith
Views
Replies
Total Likes
Thanks very much, that has worked. One quick question though - am I right in thinking that this won't work if the target control is of type 'text'? I've been able to get it to work for a 'text field' control, but not 'text'.
Thanks
Matt
Views
Replies
Total Likes
You are correct. The setFocus() method will not work for the static fields like Text, Image, Rectangle etc.
Nith
Views
Replies
Total Likes
Text objects have no place to put the cursor so no you cann "jump" to that location. You can however place a field right before the text and use that as your jump point. You could set the field to have no borders and no caption. Then make it 1 pixel by 1 pixel and lastly change the background colour to match the page colour. Now when you are in the text th efield is virtually invisible, but you can still "jump" to it.
Paul
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies