Skip to main content
Edd0
Participant
October 28, 2016
Question

Is auto tab from drop down box possible?

  • October 28, 2016
  • 1 reply
  • 769 views

Hi,

I am creating a form for local tennis clubs in the Association to enter their teams in an editable PDF. I have been able to create a form that will spawn new forms from a template, and work the way I want it to. None of this would have been possible without the info and scripts I found here, hence this request.

The auto tab function would be useful in the drop down boxes after entering the key data about each team. There are 5 drop-down boxes in a row, each of which must be completed before they can start entering players. I have made each drop down box read-only until the previous box has been completed. This is necessary to be done at the time, so that they don't have to go back at the end to find uncompleted fields. Each of these drop-down boxes has "Required" set, and I have ticked "Commit selected value immediately".

In the Actions tab I have added the following javascript to the "On Blur" event that tests if a value other than the default value has been entered. If it has, it makes the next field's readonly value false, turns the grey back to the standard colours, and changes focus to the next field.

var nFld = this.getField("P0.FormBody.SectionType");

var oNmlFld = this.getField("NormalColoursFld");

var f = this.getField("P0.FormBody.Grade");

if (event.value == "Select a Grade")

    {

    f.setFocus()

    app.alert("Please select a Grade.")

}

else{

    // Restore Normal Colours

    nFld.fillColor = oNmlFld.fillColor;

    nFld.borderColor = oNmlFld.borderColor;

    nFld.textColor = oNmlFld.textColor;

    nFld.readonly = false;    

    nFld.setFocus();

}

I cannot figure out how to make the cursor go to the next field immediately a drop down item is selected. Tabbing will move the cursor to the next drop down box, but I would like the cursor to immediately go to the next field once a choice has been made in the current field. At the moment, the next drop down box remains grey, even though a selection has been made in the current field, until the tab key is pressed and the focus goes to the next field. This form is going to be used by some people not used to this sort of document, and to see something as grey would indicate it is not available, yet it is.

I have seen numerous posts on how the auto tab can work on text fields by setting a line length limit and similar tests, such as Keystroke validation, but this option is not available for a drop down box. One of these indicate it will work if the "willCommit" code is true in the text box, but it is set in the drop down boxes I am using and is not working.

Any ideas as to how I can make this form behave the way I would like?

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
October 28, 2016

You should use the Validation event. Make sure to tick the box (under the field's Properties, Options tab) to commit the selected value immediately.

Edd0
Edd0Author
Participant
October 30, 2016

That was one of the first things I did when I read how this option worked. All drop down boxes have this Option selected.

Inspiring
October 30, 2016

What is the script for your "autotab"?

This is not a built-in feature for Acrobat.

What are the values for the export values drop down box?

Is there an option for a non-selection?

Is this form page being generated from a template?

If so, does this need to work on spawned pages?