Acrobat User Community Forums

You are not logged in.     Log in to your AUC account.     Don't have an account? Sign up today

#1 2008-01-08 14:27:56

NancyM
Member
Registered: 2007-04-24
Posts: 8

Auto tabbing not working, why?

I am not sure as to why the auto advance is not working in the following script.  The alert box does appear when a letter is entered in to the field after tabbing out.  Also, the field is cleared and focus is in the right field, but when 3 numeric digits are entered it does not advance.  I do not have anything on the Object


My Product Information:
LiveCycle Designer Pro 7 / Windows

Offline

 

#2 2008-01-14 16:02:53

thomp
Member

Registered: 2007-04-23
Posts: 641

Re: Auto tabbing not working, why?

Please re-post script

Offline

 

#3 2008-01-14 16:29:03

NancyM
Member
Registered: 2007-04-24
Posts: 8

Re: Auto tabbing not working, why?

Here is the script
----- SetupForm.ServiceAuthPage1.Phone2::exit - (JavaScript, client) --------------

if (xfa.event.newText.length == 3)

{
var r = new RegExp("^[0-9]+[0-9]+[0-9]");

var result = r.test(this.rawValue);

if (result == true)
{
xfa.host.setFocus("Phone3");
}
else if (result == false)
{
app.alert("Please enter a valid area code.");
Phone2.rawValue = null
xfa.host.setFocus("Phone2");
}
}

Offline

 

#4 2008-01-14 16:30:15

NancyM
Member
Registered: 2007-04-24
Posts: 8

Re: Auto tabbing not working, why?

Here is the script
----- SetupForm.ServiceAuthPage1.Phone2::exit - (JavaScript, client) --------------

if (xfa.event.newText.length == 3)

{
var r = new RegExp("^[0-9]+[0-9]+[0-9]");

var result = r.test(this.rawValue);

if (result == true)
{
xfa.host.setFocus("Phone3");
}
else if (result == false)
{
app.alert("Please enter a valid area code.");
Phone2.rawValue = null
xfa.host.setFocus("Phone2");
}
}

Offline

 

#5 2008-01-14 16:51:51

thomp
Member

Registered: 2007-04-23
Posts: 641

Re: Auto tabbing not working, why?

Ok, first off, because the script is on the "exit" event it is only activated when the user puts the keyboard focus somewhere else.  This is what you want for the negative test, but not for the positive test.  Break this into two scripts, one for the change event, and one for the validate event.

Also, your regular expression matches 3 or more digits.  You might want to change this to match exactly 3 digits.

EX:  var myReg = /^\d{3}$/;

Offline

 

#6 2008-01-28 14:56:02

NancyM
Member
Registered: 2007-04-24
Posts: 8

Re: Auto tabbing not working, why?

I have changed the script as you said.  This is what I have now.

----- TaxSetupForm.TaxFilingServiceAuthPage1.Phone1::validate - (JavaScript, client) ------------

var r = /^\d{3}$/;
var result = r.test(Phone1.rawValue);
if (result == false);
{
app.alert("Field is numeric only.");
xfa.host.setFocus("Phone1");
}

----- TaxSetupForm.TaxFilingServiceAuthPage1.Phone1::change - (JavaScript, client) --------------

if (xfa.event.newText.length == 3)
{
xfa.host.setFocus("Phone2");
}

When I click on the PDF Preview tab I receive the following warning.

Script failed (language is javascript; context is xfa[0].form[0].TaxSetupForm[0].TaxFilingServiceAuthPage1[0].Phone1[0])
script=var r = /^\d{3}$/;
var result = r.test(Phone1.rawValue);
if (result == false);
{
app.alert("Field is numeric only.");
xfa.host.setFocus("Phone1");
}
   Error: app is undefined

I am getting the alert box "Field is numeric only" before the form opens.   Then when I test the field the alert box appears no matter what was entered (all numeric or containing an alpha value).  One thing I did notice is if I key an all numeric value again the validation seems to be working and the auto tab works. 

Any insite as to what I am doing wrong.

Last edited by NancyM (2008-01-28 14:59:57)

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson

AcrobatUsers.com  >>  User Groups • News • Events • Articles • Blogs • How To • Resources • Member Log in