Are you wanting there to be three radio buttons, one of which says, "None of the above" and have it deselect whichever of the other two is selected when the user clicks that third radio button?
Thanks for the quick reply. Actually, what I was hoping to have is two buttons.
The scenario is that I have a default action "add" and two other possible actions "create" and "replace." If they do not select a button the default "add" occurs. If they do select a button one of the other two actions occurs.
However, only one of those three actions can occur so they should not be able to select both buttons - just one button (create or replace) or no button (add).
Does that make sense?
What you're describing is the default radio button behavior. When one radio button is selected, any other button that is selected is automatically deselected.
Now, where you may have an issue is if you want all the radio buttons to be deselected by the user. This can be accomplished by clicking in the field (which will usually select one of the options) and then pressing the "Backspace" or "Delete" key. If that's too arcane for your users, you can make a button and attach a short script (or a single script step) that says, "Set Field [ "Action" ; "" ]". This will cause the contents of the field to be removed, clearing all button selections.
Radio buttons, by their nature, only allow one selection. But tricky Users can hold shift and select more than one. Two things I would suggest (both take place in the field's Options definition):
1) Set validation to member of value list (create a custom value list with these three possible selections). Below on 'display message' enter something such as "You cannot paste into this field or leave it empty. Select from the radio button."
2) Set auto-enter by calculation as: GetValue ( text ; ValueCount ( text ) ). After you exit the calculation and are back at the Auto-Enter tab, UNCHECK right below where it says, "do not replace existing value of field (if any). ... where 'text' is your field name.
These two precautions should achieve what you wish.
Message was edited by: LaRetta ... so that Users can't delete the entries (leaving the field blank), check 'not empty' in the validation as well. This will force them to return some value to the field. This can be handled with script trigger also but if you do, still leave field-level validation in place for security.
"The scenario is that I have a default action "add"
BTW, I assume you mean that you have an auto-enter DATA with 'Add' as the value so that all new records begin with this value? If you put my suggestions in place, you will need to find all records with empty value and pre-fill with 'Add' before you add the validations to the field definition.
Thnks for the help! I have done what you said, but I still have a problem. Is there a way to make it so when a user clicks a button and then clicks it again the button deselects? In other words, I now have two values: "create" and "replace." If I do not see a value in that field I my script will do the default "add."
What if a user wants to "replace" but then decides they don't want to replace but instead "add?" I need them to be able to change their mind by clicking on the "replace" button again and having it deselect.
Is that possible?
Actually, this script creates an xml file for another program. That program has a default action "add" so if there is no value "replace" or "create" in the xml then it "adds" by default.
No problem. :^)
- The default when record is created is empty instead of auto-enter data.
- Set auto-enter by calculation as: GetValue ( text ; ValueCount ( text ) ). After you exit the calculation and are back at the Auto-Enter tab, UNCHECK right below where it says, "do not replace existing value of field (if any). ... where 'text' is your field name.
- Value list would contain "Create" and "Replace".
- Field-level validation should remain as specified 'member of value list' but remove the 'not Empty' suggestion.
- Create a script with: Set Field [ yourTable::RadioButton ; Case ( yourTable::RadioButton = Get ( ScriptParameter ) ; "" ; yourTable::RadioButton )
- Create script trigger (attach it to the field itself) OnObjectModify and point to script you create in #5. Include a script parameter of simply your field, ie just select your field from the pop-up to insert it into the calc dialog.
This will achieve the following:
- User can select Create but change their mind. If they click Create again, it will remove the value. (handled by 5 & 6)
- User can not select more than one item (handled by 2)
Thanks so much!