Fillable Field - Navigation to Button

Forum for the PDF-XChange Editor - Free and Licensed Versions

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

DaveA
User
Posts: 5
Joined: Fri Oct 05, 2018 9:42 am

Fillable Field - Navigation to Button

Post by DaveA »

My fillable form has a text entry field, from which the user is expected to press a button.This processes the data in the field using a javascript action.

Unless the mouse is used to click another form element between the text entry field and the button, the javascript finds the text entry field empty even though character are shown in the text field.

What can I do to ensure the data entered into the text field is registered prior to running the javascript (or is there a javascript command I am missing?)

My OS is MS Windows 10 Pro, version 10.0.17134 Build 17134
PDF-XChange Pro 7.0.326.1
PDF-XChange Tools 7.0.326.1


Javascript shown below....

// get scheme number entered

var s = this.getField("Scheme_No").value;

if(s == "") {
app.alert("New Scheme field is blank");
}else if (/^[0-9A-Z]+$/.test(s)) {
var sl = this.getField("Scheme_Number").value;
if(sl == "") {
this.getField("Scheme_Number").value = s;
}else{
var parts = sl.split(",");
if (isInArray(s,parts)){
app.alert("This scheme has already been added");
}else{
app.alert("Adding scheme to list");
this.getField("Scheme_Number").value = sl + "," + s;
}
}

// clear data entered
this.getField("Scheme_No").value = "";
}else{
app.alert("New Scheme field contains illegal characters");
}

function isInArray(value, array) {
return array.indexOf(value) > -1;
}
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3550
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada

Re: Fillable Field - Navigation to Button

Post by Ivan - Tracker Software »

I made a simple form trying to reproduce the problem but seems I was unsuccessful in that.
Can you please check my form (it just output text field value to the JS console, when the button is pressed) and let me know what you are doing differently?
Or send me your form which has the problem and I will take a look.
You do not have the required permissions to view the files attached to this post.
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
DaveA
User
Posts: 5
Joined: Fri Oct 05, 2018 9:42 am

Re: Fillable Field - Navigation to Button

Post by DaveA »

Hi Ivan
Thanks for the quick response. I have checked your form and can not reproduce the error on it.
I will have to see what is different in my form causing this error, maybe by deleting the fields and re-creating them.
I'd send my form to for you to observe, but it is confidential to my employers.
I'll advise results on Monday.
Thanks
DaveA
User
Posts: 5
Joined: Fri Oct 05, 2018 9:42 am

Re: Fillable Field - Navigation to Button

Post by DaveA »

Hi Ivan
The fix was to execute the javascript on a mouse up event, and not a mouse down.... simple when pointed in the right direction. Thanks
User avatar
Will - Tracker Supp
Site Admin
Posts: 6815
Joined: Mon Oct 15, 2012 9:21 pm
Location: London, UK

Re: Fillable Field - Navigation to Button

Post by Will - Tracker Supp »

:D
If posting files to this forum, you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded.
Thank you.

Best regards

Will Travaglini
Tracker Support (Europe)
Tracker Software Products Ltd.
http://www.tracker-software.com