Is there a way to make a item disappear when a button is clicked? For example I have a Entered by field that when you click the button beside it the Entered by field simply is populated with {" " + user.realname + ", " +DATETIMESTAMP()}. This would be fine if only people doing the note where making the entry themselves, but we leave the option open to type in someone and then select a date. So the edit field for date is beside the edit field for entered by and the button to populate the edit field.
Can I make it so when that button is clicked the date edit field disappears so there would be no confusion to make a double entry of the date?
Sure, you could put the date field in a visibility field whose rule to show the field is that the "Entered by" field is blank. Or you could set a variable or obs term in the code for the button push and use that value being not present/present for the visibility rule.
If they type into the entered by field we want to be able to select a date. So I don't know if the visibility option would work and I'm not really clear on how to do the second option.
I guess I could remove the datetimestamp on the button and just have it populate the name
Your button would be coded with
{" " + user.realname + ", " +DATETIMESTAMP()}
{document.ButtonPushed = "Pushed"}
And your visibility region would be
document .ButtonPushed <> "Pushed"
Should the button be a calculation and target to the edit field, or a run process button?
If it's runprocess how do I get it to populate the edit field
RUNPROCESS
{OBSNOW("OBSTERM"," " + user.realname + ", " +DATETIMESTAMP())}
{document.ButtonPushed = "Pushed"}
or
RUNPROCESS
{document.whatever=" " + user.realname + ", " +DATETIMESTAMP()}
{document.ButtonPushed = "Pushed"}
Thank you! Works exactly how i wanted it to
Just curious is there like a unpushed command for buttons also. Ive never used "pushed" or even knew a button could have an item name like document.ButtonPushed.
Those are just variable names I made up. When you see document.xxxxx, the xxxx is your variable name. Since you set a value to the variable when someone pushes the button, if the variable doesn't have a value - that indicates "unpushed"