Skip to main content
Participating Frequently
March 29, 2022
Answered

Adobe stamp with Javascript form, hide field

  • March 29, 2022
  • 1 reply
  • 2598 views

Hi,

I have 2 questions.  

First, how can I hide a field in my stamp depending of the user choice in the form? 

I have try this : 

	commit: function(dialog)
	{
		//First choice
		if(results["rNa1"])
		{
			this.getField("P2-chkEnonce3").display = display.hidden;
		}
	}

and that :

if(event.source.forReal && (event.source.stampName == "#PGrZrfrVBCosilVE8PCtgC"))
{
     if("ok" == dialogConformiteFR.DoDialog())
	{	    
		this.getField("P2-chkEnonce3").display = display.hidden;
	}
}

but my checkbox never get hidden in my stamp.

 

My second question is where in the script can I manage what's being check in the form ? 

Only one checkbox need to be check at a time.

 

Thank you ! 

This topic has been closed for replies.
Correct answer try67

How can I disable a field in my dialog ? 

I have a radiobutton rNa1 and when it's checked I want to disable radiobutton rRe6.
Right now, I'm only displaying an error message if rRe6 is checked with rNa1.

	rRe6: function(dialog)
	{
	    var elements = dialog.store()["rNa1"]
            if(elements) app.alert("Error");
	},

 

Thank you !


You need to assign a function to rNa1, in which you check its value, and if it is checked call this command:

dialog.enable({"rRe6": false});

1 reply

Participating Frequently
March 29, 2022

Edit : ignore the image in my original post.  This one here is the good one.

Thank you ! 

try67
Community Expert
Community Expert
March 29, 2022

You can't hide a field in a dialog. You can disable it, though.

Participating Frequently
March 29, 2022

Ok for the dialog but what about in the stamp ? Can I control which field are visible before inserting it in the pdf ? 

 

On a side note, I have add this to my script, I thought it would uncheck the checkbox in the dialog but it doesn't do anything.  Maybe "document" is not what I need to use.  

 

	rNa1: function(dialog)
	{
		var elements = dialog.store()["rNa1"]

		if (elements == 1) 
		{
			document.getElementById("rNa6").checked = false;
			document.getElementById("rNa7").checked = false;
			document.getElementById("rNa8").checked = false;
		}
	},

 Thank you