• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Adobe stamp with Javascript form, hide field

New Here ,
Mar 29, 2022 Mar 29, 2022

Copy link to clipboard

Copied

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 ! 

TOPICS
How to , JavaScript , PDF forms

Views

1.3K

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
community guidelines

correct answers 1 Correct answer

Community Expert , Apr 13, 2022 Apr 13, 2022

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});

Votes

Translate

Translate
New Here ,
Mar 29, 2022 Mar 29, 2022

Copy link to clipboard

Copied

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

Thank you ! 

Votes

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
community guidelines
Community Expert ,
Mar 29, 2022 Mar 29, 2022

Copy link to clipboard

Copied

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

Votes

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
community guidelines
New Here ,
Mar 29, 2022 Mar 29, 2022

Copy link to clipboard

Copied

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 

Votes

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
community guidelines
Community Expert ,
Mar 30, 2022 Mar 30, 2022

Copy link to clipboard

Copied

You're copying and pasting code from places that are not relevant to what you're working on...

Yes, it can be done, but you're better off doing it from outside the dialog object entirely.

After it is closed, examine the results from it and then show/hide the fields.

The correct syntax for that is what you used earlier:

this.getField("P2-chkEnonce3").display = display.hidden;

Votes

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
community guidelines
New Here ,
Mar 30, 2022 Mar 30, 2022

Copy link to clipboard

Copied

Instead of wanting to hide/show, check/uncheck depending of the user choice, I will make 3 separate stamps, it will be much easier.  I'm too new in that to understand it all !  I will search for online tutorial to better understand Javascript with Acrobat form.

Thanks for your help

 

Votes

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
community guidelines
Community Expert ,
Mar 30, 2022 Mar 30, 2022

Copy link to clipboard

Copied

I don't really see the need to show/hide fields in a stamp anyway, to be honest. Why not simply keep them empty? Unless they have a fill or border color, or something like that, that would have the same result as hiding them.

Votes

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
community guidelines
New Here ,
Apr 04, 2022 Apr 04, 2022

Copy link to clipboard

Copied

Depending on what choice is selected in the Javascript form, some field would not have been relevant.

See attached image, I hope it make it more clear.  But making 3 differents stamps was more simple to manage.

Votes

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
community guidelines
New Here ,
Apr 13, 2022 Apr 13, 2022

Copy link to clipboard

Copied

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 !

Votes

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
community guidelines
Community Expert ,
Apr 13, 2022 Apr 13, 2022

Copy link to clipboard

Copied

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});

Votes

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
community guidelines
New Here ,
Apr 14, 2022 Apr 14, 2022

Copy link to clipboard

Copied

LATEST

It's working fine, thank you so much !

Votes

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
community guidelines