Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Fillable form; required fields w/error messages; tabbing sequence goes to the top of the form.

New Here ,
Mar 15, 2017 Mar 15, 2017

Acrobat Pro DC: I've created a fillable form (with required fields which have error messages if they are "tabbed through"). After I return to and complete one of these fields, the tabbing sequence returns to the top of the form, instead of resuming from where I am. How can I make the tabbing resume from the current location?

TOPICS
Acrobat SDK and JavaScript , Windows
641
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Mar 15, 2017 Mar 15, 2017

How have you set the error messages for the required field? Are you using a JavaScript for this?

You might need to ensure -- as part of the JavaScript -- that the field that is being checked remains active. (e.g. the cursor is returned back to that field allowing the user to enter required data).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 16, 2017 Mar 16, 2017

Hi, Cari.  Thank you for your reply.  Yes, I am using javascript for the error messages.  Below is an example; each required field has a similar, but customized “Specify the…” message.

f = getField(event.target.name)

if (f.value.length == 0)

    {

    f.setFocus()

    //Optional Message - Comment out the next line to remove

    app.alert("This field is required. Specify the NPI.")

    }

I am not a “programmer,” I am a writer/editor; so this javascript stuff is new to me.  Any idea what I’ll need to add to this in order to ensure that “the field that is being checked remains active”? Thank you very much!

- Kevin

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Mar 16, 2017 Mar 16, 2017

I've moved this post to the Javascript subspace on Acrobat forums in the hope someone there can help you.

I've spent about 30mins trying to see if I could add a 'goNext()' function that would force going to the next field, but I'm thinking the entire script might need an overhaul to work properly, as when you just click in the fields you leave empty and don't use Tab controls things don't work properly either (no alerts appear).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 17, 2017 Mar 17, 2017

In what context are you using this script?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 17, 2017 Mar 17, 2017

Karl, thank you. I am using the script to tell users that the field is required (i.e., if they tab out of it without having entered data, they get an 'error' message). I was hoping that the script could be enhanced such that after the user correctly populates the field, pressing Tab would bring them to the next (sequential) field instead of the current behavior: returning user to top of form...causing them to have to "tab" repeatedly to return to where they left off.   My form has ~60 editable fields; roughly half of which are "required." Thank you.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 17, 2017 Mar 17, 2017
LATEST

You still have not answered my question, but based on your description, I assume you are using this as an "on blur" script. Is that correct?

In general, it's a bad idea to force a user to fill in a certain field on your terms. Users fill out forms in all different ways, and the only thing that is important is that at the end, the form is completely filled. I would not force the user to enter data while they are tabbing through a form. Also, your method only works if the user actually tabs from field to field, if they click and skip certain fields, they will never get the error message.

Chances are that you've marked the fields as "required", so they have the red border that indicates that the user has to fill these fields. At the end, I would provide a "validate complete form" method - either as part of your submission function, or as a separate function that then lists all fields that still need to be filled.

However, if you want to keep your solution, switching around the two lines should do the trick. One more thing: It is not necessary to get the field based on the name, you already have a reference to the field using 'event.target':

f = event.target;

if (f.value.length == 0)

{

    app.alert("This field is required. Specify the NPI.");

    f.setFocus();

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Mar 15, 2017 Mar 15, 2017

Also if you are using JavaScripting let us know and we'll move this question to the appropriate forum in that case.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines