Is there a way to force space in field?

Explorer ,
Jul 08, 2017

Copy link to clipboard

Copied

Hi,

So I have a field called "striInitDocNum" defaulted to 1 as shown below:

global.DocNumAction =

{

strInitDocNum:"1"

}

The code then inserts a space before this default value:

var dlgInit =

{

"DNum": " " + this.strInitDocNum

}

However, the user may remove this space in the form if they want to set to a different value from 1 to 2, for example:

                                    to

How can I make it so if the user decides to enter a different value than the default, the space in the field is maintained such they cannot delete it? This matters b/c the preview field (not shown) ends up also having a removed space and then it shows as "Exhibit2" instead of "Exhibit 2"

Thanks.

S

Adobe Community Professional
Correct answer by Joel_Geraci | Adobe Community Professional

You can't. However, you can check for the existence of the space after they have entered their value and then update the value if necessary.

TOPICS
Acrobat SDK and JavaScript, Windows

Views

106

Likes

Translate

Translate

Report

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

Is there a way to force space in field?

Explorer ,
Jul 08, 2017

Copy link to clipboard

Copied

Hi,

So I have a field called "striInitDocNum" defaulted to 1 as shown below:

global.DocNumAction =

{

strInitDocNum:"1"

}

The code then inserts a space before this default value:

var dlgInit =

{

"DNum": " " + this.strInitDocNum

}

However, the user may remove this space in the form if they want to set to a different value from 1 to 2, for example:

                                    to

How can I make it so if the user decides to enter a different value than the default, the space in the field is maintained such they cannot delete it? This matters b/c the preview field (not shown) ends up also having a removed space and then it shows as "Exhibit2" instead of "Exhibit 2"

Thanks.

S

Adobe Community Professional
Correct answer by Joel_Geraci | Adobe Community Professional

You can't. However, you can check for the existence of the space after they have entered their value and then update the value if necessary.

TOPICS
Acrobat SDK and JavaScript, Windows

Views

107

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jul 08, 2017 0
Adobe Community Professional ,
Jul 08, 2017

Copy link to clipboard

Copied

You can't. However, you can check for the existence of the space after they have entered their value and then update the value if necessary.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 08, 2017 0
Most Valuable Participant ,
Jul 09, 2017

Copy link to clipboard

Copied

Fix it in the calculate script of the preview field.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 09, 2017 0
Explorer ,
Jul 09, 2017

Copy link to clipboard

Copied

Ok, I understand. Thx.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jul 09, 2017 0