Expand my Community achievements bar.

Trying to get a handle on the flow for the “Set Focus” code

Avatar

Level 5

Good Day All;

With help (a lot) from djaknow I was able to the setfocus working on a form I created. Then I went ahead and created more sub forms and tables. It seems that I may have not completly understood the flow for the "Set Focus". Below is the hierarchy of the form I am working on. I would appreciate any help with this. This is the set focus code I am using.

xfa.host.setFocus(form1.requester_info.Table3.Table2.Table4.new_req.Table5.Row2.r_new);

Form1

            Master Pages

            Page1

Requester_info

            (T+)Header

            Table3

                        Row1

                                    DateTimefield

                                    (T+)Cell2

                                    TextField

            Table2

                        Row1

                                    r_name

                                    r_section

                                    r_phone

            StaticText1

            Table4

                        Row1

                                    r_new

                                    r_change

                                    r_remove

            StaticText2

            New_req

                        StaticText3

                        Table5

                        Row1

                                    (T+)Cell1

                                    (T+)Cell2

                        Row2

                                    r_new

                                    d_new

Thanks all

6 Replies

Avatar

Level 7

Hi Chomp,

Try this. Click in the field you're going to be exiting, click inside the script editor and ctrl + click on the Row2.r_new field. This will resolve the path for you.

Avatar

Former Community Member

Are you trying to put the cursor into a field that is inside a newly created subform - added through an addInstance command?

Paul

Avatar

Level 5

Thanks djaknow;

Your tip to find the path works like a charm. It came up with

xfa.resolveNode("form1.requester_info.new_req.Table5.Row2.r_new"), Nice

I replaced this line with

Xfa.host.setFocus(form1.requester_info.new_req.Table5.Row2.r_new);

I added this to the “click” event for the checkmark object. Believe it or not. This did not work.

I then removed this from the “click” event and added it to the “initialize” event. It worked.

Now I am way confused. I took a look at the java script console and the only thing it will show is the following with no other messages

Acrobat JavaScript Debugger Functions Version 7.0

Acrobat Database Connectivity Built-in Functions Version 8.0

Acrobat EScript Built-in Functions Version 8.0

Acrobat Annotations / Collaboration Built-in Functions Version 8.0

Acrobat Annotations / Collaboration Built-in Wizard Functions Version 8.0

Acrobat Multimedia Version 8.0

Acrobat SOAP 8.0

Avatar

Level 5

Hello pguerett;

No, I thought what I was trying to do was sort of straight forward. It started out that I wanted to have the cursor placed in the first field when the form was opened. From there If you clicked on one of the 3 check boxes the cursor would focus in the text field that relates to the check box. From this point I wanted to hide any field that were not required by the user. In other words, when the user clicked on the check box, the related text field would become visible (was hidden) and the cursor would be placed in the text field.

I am now at the point of getting the cursor to focus on the text box releated to the check mark selected.

Hope this makes sense.

Chomp

Avatar

Former Community Member

For getting the cursor into the 1st field on start up that is not as straight forward as it seems. I have added a sample to show you. The code is on the DocReady event of the form1 object.

For putting the cursor into another field when the checkbox is clicked then you are going about it the right way. Check the javascript console for syntax errors.

Paul

Avatar

Level 5

Thanks djaknow and  pguerett. The first part of this is working like a charm thanks to both of you.

I have run into a new issue which I will do a new post as this question has been answered.

Chomp