Skip to main content
Participant
August 17, 2022
Answered

Custom stamp format null fields

  • August 17, 2022
  • 1 reply
  • 1086 views

I've got a custom dynamic stamp built and it prompts me for inputs.  If I cancel input on that field, it places "null" in the stamp for that field.

 

I saw a video that said I needed this script in the format section of the field properties.  Except it's still populating null in the field.  I've tried removing the quotes from null in the first line and that didn't work either.  

 

if(event.value=="null")
{event.value=""}

This topic has been closed for replies.
Correct answer try67

Since the null value is converted to a string when you apply it to the field's value, change the code back to this:

if (event.value=="null") event.value="";

But place it under the field's Validation event, not Format.

1 reply

try67
Community Expert
Community Expert
August 17, 2022

Null is not a string, but an object, so remove the quotes around it. If that doesn't work post the full code.

Participant
August 17, 2022

Here's the code:

 

 

//-------------------------------------------------------------
//-----------------Do not edit the XML tags--------------------
//-------------------------------------------------------------

//<AcroForm>
//<ACRO_source>AFE:Format</ACRO_source>
//<ACRO_script>
/*********** belongs to: AcroForm:AFE:Format ***********/
if(event.value==null)
{event.value=""}
//</ACRO_script>
//</AcroForm>

//<AcroForm>
//<ACRO_source>Script:Calculate</ACRO_source>
//<ACRO_script>
/*********** belongs to: AcroForm:Script:Calculate ***********/
if ((event.source.forReal)&&(event.source.stampName == "#FieldAFEStamp"))
{

this.getField("AFE").value = app.response("AFE#");
this.getField("CC").value = app.response("Cost Center#");
this.getField("Property").value = app.response("Property Name");
this.getField("Major").value = app.response("GL Account - Major");
this.getField("Minor").value = app.response("GL Account - Minor");
this.getField("Ordered").value = app.response("Ordered By");
this.getField("Date").value = app.response("Date");
this.getField("RouteToApprover").value = app.response("Route to Approver");
}


//</ACRO_script>
//</AcroForm>
try67
Community Expert
Community Expert
August 17, 2022

This can of worms is on you.  I'm brand noob here.  This is my first javascript ever anywhere.

 

Is there a way to convert this from 10 questions, each requiring an "OK" to proceed, into a single form with 10 fields, and still have that null validation?

 


Yes, you can do it using a Dialog object, but those are much more complicated to code.
If you're interested I could do it for you (including the null validation) for a small fee.

You can contact me privately to discuss it further.