I have a master form that is basically a questioniare that, based on how each question is answered, displays a button. In reality, there are two identical buttons - one red and one green. The red button is displayed initially and clicking on the button creates a child document. Once some required fields are filled in and the child document saved, the red button on the parent is hidden and the green button is displayed. As many as 13 different child document may be created in this manner from 30+ buttons.
My problem comes in when the parent document is routed for approval. I would like to be able to determine how many, if any, red buttons are visible, so that I can prompt the user to complete or create these child documents before submitting for approval. I came up with a couple of hidden fields - RedButtonsVisible and GreenButtonsvisible to record which ones are visible and which ones are not. My question is, is there an easy way to determine if a button is visible or not? There are probably 35 buttons on this parent document that create child documents based on the answer given to a question. Each button has a fairly complex Hide-When formula. How can I record when a button is visible and when it is not?
Subject: How do you record when a button is visible or not?
Aside from having a variant of your hide-when formulas evaluate the value of another field to display the list of which buttons should be visible at that moment.
I don’t believe that buttons or any other elements have statuses you can reference like that from the Notes Client. (could be wrong, could be useful!)
On Web, Instead of Hide-When’s (which remove the elements completely from the displayed HTML) I would use the "Disabled’ or “Enabled” properties of elements to determine whether they were accessible or not. Example:
My Disabled Button
[edit]
You can use Javascript to reference the value of the property.
if(document.theformname.Button1.Disabled==True) Then {…
Subject: RE: How do you record when a button is visible or not?
Michael, are you using Hide When formulas to show or hide the buttons? If yes, show us the hide when formula.
I often use field values rather than formulas that compare things. For instance, a hide when formula might be simply, ShowRedButton12. The value of that field is computed and results in a 1 or 0.
Subject: RE: How do you record when a button is visible or not?
… For instance, a hide when formula might be simply, ShowRedButton12. The value of that field is computed and results in a 1 or 0.
… and summing the values will give you the number of red buttons shown.
Another way would be, if the user never can go back to the red button, while you create the child document, to increment a single field in the parent doc…
Subject: RE: How do you record when a button is visible or not?
Ok, here is what I came up with that works pretty good.
I created a computed hidden field for each button. In the formula of the hidden field I evaluated the Hide-When of the corresponding button. If the button evaluate be hidden, I return “Invisible”, if it evaluates to not be hidden, I return “Visible”. If the hidden field is “”, I return “Not Selected”. When the document is submitted I created a routine to evaluate the status of all the buttons. Then I find all the red buttons and get a description of the button and it’s location. I put this information in the RedButtonsVisible Hidden field I created originally. Then I put that info in a messagebox and alert the user.
It’s working pretty good, but I worry that Messagebox won’t hold everything if I have lots of red buttons.