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 !
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});
Copy link to clipboard
Copied
Copy link to clipboard
Copied
You can't hide a field in a dialog. You can disable it, though.
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
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;
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
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.
Copy link to clipboard
Copied
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 !
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});
Copy link to clipboard
Copied
It's working fine, thank you so much !