Skip to main content
Known Participant
February 19, 2009
Question

Radio button validation

  • February 19, 2009
  • 3 replies
  • 727 views
Using coldfusion validation only, how can I make a radio field required? For example, the below code does not work:

<cfinput type="radio" name="test" value="yes" required="true" message="You must enter a value for test">
<cfinput type="radio" name="test" value="no" required="true" message="You must enter a value for test">
    This topic has been closed for replies.

    3 replies

    Inspiring
    February 20, 2009
    just make one of your radio buttons pre-selected (i.e. the default choice).
    in a radio group only one of buttons can be selected at a time, and if
    you have one pre-selected then one of the buttons will always be
    selected because a radio button can't be 'un-checked'.


    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com/
    Inspiring
    February 19, 2009
    Pre-select one.
    Participating Frequently
    February 19, 2009
    try using <cfif arounf your radio buttons
    <cfif this condition
    Radio1
    <cfersle>
    radio2