Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Repositioning the cursor when check box is selected

Avatar

Level 5

Good Day All;

I am trying to figure out how I can reposition the cursor to a text field after I select a check box.

Example; I have 3 check boxes that the use can select. When the user selects the check box, I would like to cursor to move to that check box.

Does anyone know how this could be done?

Using Adobe LifeCycle Designer 8.0

Windows XP Pro

Thanks All

Chomp

1 Accepted Solution

Avatar

Correct answer by
Level 7

No problem Chomp, I've updated the form you posted to set the focus in the first textfield in the hidden subform (test 1). I've reposted the form here:

https://acrobat.com/#d=46bhrRPpzUOEN4XI7--W-w

Notice how the full path must be spelled out when the linked fields, in this case a checkbox and a text field, are in different subforms.

If you ever aren't sure what the full path to a field is, select a different field, click in the script manager window and then ctrl + click on the field you want the path for. If you have that field selected ctrl + click will just return "this" since it will be referencing itself in the script manager.

View solution in original post

9 Replies

Avatar

Level 7

Sure, on the click event of the check box put this script:

xfa.host.setFocus(formName.subformName.textfieldName);

Avatar

Level 5

Thanks Zdjaknow;

I have not been able to get this to work. So let me tell you what I have.

I am currently running another scrip on the check box (see below) that will open up a text field if clicked. I added the following code (thank you) to the end of the “if” statement. Is there something I am doing wrong?

Form name=        R_R_Change_New

Subform Name= rolen

TextField Name = reason_new

if( this.rawValue == 0 )

{

rolen.presence = "hidden"

}

else

{

rolen.presence = "visible";

}

xfa.host.setFocus(R_R_Change_new.rolen.reason_new);

Thanks again djaknow

Chomp

Avatar

Level 7

In the code you posted you're missing a ";" after hidden which is a potential problem and you have the "N" capped in one spot on the form name but in the script you have it lower case. Also, you may need to put the script I gave you within the "{}" right after making the field visible. Is there a reason you're hiding the rolen text field? It would be a good idea to leave the field visible and comment out everything but the script I gave you to make sure the cursor is being repositioned on the checkbox click.

Another thing you can do is hit ctrl + j when you're in preview, this will open up the javascript debugger to help you check your code.

Avatar

Level 5

Thanks again djaknow

This thingy is starting to drive me a wee bit nuts. I removed (made visible) all of the sub forms and added the code as you described. Did not work. Then I created a new form with 2 sub forms. One for the check box and one for the text box. Inserted your code and again it did not work.

I then ran the Java Script debugger and it came up with the form name not known. I took the form name out and ran with the following code;

xfa.host.setFocus(subformname.textfieldname); So it looked like this

xfa.host.setFocus(thisis.youare); Worked like a charm.

Went back to the original form and changed the code. Still did not work. At the same time I am no longer getting any errors with the Java console. This is the only code I am using.

xfa.host.setFocus(change_new.reason1);

Form name         RRChangenew.pdf

Subform           change_new

Textfieldname     reason1

As I said… driving me a wee bit crazy

Avatar

Level 7

Hello again,

I made a sample for you, you can check it out here:

https://acrobat.com/#d=gP-tjO8uzbbqDcbNEd0J1A

Avatar

Level 5

Hello Again djaknow.

Ok.... I may have lost a brain cell or two over this so...... I reviewed your example... changed my form around to see if that would work and nope.

Would it be possible for you to have a look see at what I have done and let me know where I have pooched it. The form is at:

https://acrobat.com/#d=n2chLjWF1AyM3ezYFvSSJA

Thanks djaknow

Avatar

Correct answer by
Level 7

No problem Chomp, I've updated the form you posted to set the focus in the first textfield in the hidden subform (test 1). I've reposted the form here:

https://acrobat.com/#d=46bhrRPpzUOEN4XI7--W-w

Notice how the full path must be spelled out when the linked fields, in this case a checkbox and a text field, are in different subforms.

If you ever aren't sure what the full path to a field is, select a different field, click in the script manager window and then ctrl + click on the field you want the path for. If you have that field selected ctrl + click will just return "this" since it will be referencing itself in the script manager.

Avatar

Level 5

Hello djaknow;

Worked like a charm, thank you. I think where I made my first mistake is the initial design of the form (subforms). So thank you for the "2" lessons.

I will need to go back over the form and take a look at how I have put the subforms together.

Thanks again djaknow

Chomp

Avatar

Level 7

You're welcome, happy to help.