I have a form with a number of radio buttons, and I'm wanting to be able to
select a default vaule, or alternatively give the user their prior
selections on this form.  I can do it with a series of CFIF (or
alternatively using CFSWITCH,  but the coding in the newfangled CFFORM is so
cool, I feel sure there must be a way to do this in a much simpler way.
Like for example surely there's a parameter in the input/radio tag to allow
it to be checked if the value matches.

I looked through the docs, and couldn't see an example of any cfinput
type=radio where the value was set by coldfusion.

Is there an easier/shorter way to accomplish what I'm trying to do than
this:  ( I think if you had a list of 20 or more radio buttons as i've done
before today you'd end up with a seriously unweildy piece of code.)
[quote]
 <cfformgroup type="horizontal" label="Preferred Payment Method:">
  <cfif order.getpaymentmethod() eq "Visa">
  <cfinput type="radio" name="PaymentMethod" value="Visa" Label="Visa"
checked="true" >
  <cfinput type="radio" name="PaymentMethod" value="Mastercard"
Label="Mastercard"  >
  <cfinput type="radio" name="PaymentMethod" value="Amex" Label="Amex"  >

  <cfelseif order.getpaymentmethod() eq "Mastercard">
  <cfinput type="radio" name="PaymentMethod" value="Visa" Label="Visa"  >
  <cfinput type="radio" name="PaymentMethod" value="Mastercard"
Label="Mastercard"  checked="true"  >
  <cfinput type="radio" name="PaymentMethod" value="Amex" Label="Amex"  >

  <cfelseif order.getpaymentmethod() eq "Amex">
  <cfinput type="radio" name="PaymentMethod" value="Visa" Label="Visa"  >
  <cfinput type="radio" name="PaymentMethod" value="Mastercard"
Label="Mastercard"  >
  <cfinput type="radio" name="PaymentMethod" value="Amex" Label="Amex"
checked="true" >
  </cfif>
 </cfformgroup>
[/quote]



Cheers
Mike Kear
Windsor, NSW, Australia
Certified Advanced ColdFusion Developer
AFP Webworks
http://afpwebworks.com
ColdFusion, PHP, ASP, ASP.NET hosting from AUD$15/month


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:235722
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to