We help IT Professionals succeed at work.

help with processing radio btns

jriver12
jriver12 asked
on
I know that this is probably easy for some of you out there.
I am having a problem with my form. it has 2 radio btns that are the basis of actions to follow. on my actio page I have several actions that are based off of these radio btns.  i know that radio btns do not have a value until checked and I beleive that that is my issue, how can I trick cf to beleive there is a value and to keep on processing my form.

my actions page has several queries and actions that happen depending on if the radio btns are there or not.

for example my 1st action is

<cfif (form.radiobtn1)EQ 1 and (form.radio2)eq and (form.amt) EQ or gt 0>
<query> run this query</Query>
<cfmail>
<cflocation>
this works fine.
but
when I add another <cfIf> where either 1 or both radio btns are not checked then I get an error saying that those fields and or variables that correspond to those radio btns aremissing or spelled wrong?  

does anyone have an Idea of how I can work this issue?
Comment
Watch Question

Commented:
put this on top of the processing/action page:
<cfparam name="form.radiobtn1" default="valuefornotchecked">
<cfaparam name="form.radiobtn2" default="valuefornotchecked">

HTH,
CJ

Author

Commented:
Thanks for the time again CJ.

I've come up with this on the action page:

<cfif isdefined("form.invoiceme")>
     <cfset form.invoiceme = "1">
     <cfelse>
     <cfset form.invoiceme = "0">
     </cfif>    

Author

Commented:
points are for time spent.  thanks ..

Commented:
cfparam does the same without the if then else...

It will set the value only if the variable doesn't have one or exist.

CJ

Author

Commented:
AH!! I see said the Blind Man!!!!!!!! :)

Explore More ContentExplore courses, solutions, and other research materials related to this topic.