Hi,
If this gets paosted twice I am sorry(My First Post`-`)
My name is John and I am trying to figure out how to make a friendly (not
required) form with radio buttons. I am also trying to write the data to a
MySQL (any database really). Everything works great just using post, but when I
try to add the database I run into problems.
Somebody, introduced me to the cfparm, with default value. This makes things
work, but now I am trying to get the form to work in one of three ways:
(1) Checked =Yes
(2) Checked =No
(3) Checked =Not Entered
It seems now the default value="Not Entered" also gets written to the database.
Should I use the
cfqueryparam over the cfparam? I am lost on how to do this.
Is there a way to have a default value, but have have that default value
updated, and have only one entry writen to the database
Thank you so much,
John Barrett
The Form:
<cfparam name="form.Checked" default="Not Entered">
<!--- If the radio button was checked, write output to database --->
<cfquery name="Add" datasource="John">
INSERT INTO John(Checked)
VALUES('#Checked#')
</cfquery>
<html>
<head>
<title> Radio Button Checked or Not</title>
</head>
<body>
<h2>Was Radio Button Checked?</h2>
<cfoutput>
<form action="#CGI.Script_Name#" method="Post">
</cfoutput>
<b>Is the Radio Button Cheked?</b>
<input type="radio" name="Checked" value="Yes">Yes
<input type="radio" name="Checked" value="No">No
<p>
<input type="submit" name="submit" value="submit">
</form>
<!--- If the page has been submitted to itself, output the values passed by
the form --->
<cfif IsDefined('form.Submit')>
<hr>
<!--- Output the mailing list value from the radio button --->
<cfif IsDefined('form.Checked')>
<b>Radio Button:</b> <cfoutput>#Checked#</cfoutput>
<cfelse>
<b>Radio Button:</b> Not Entered! <br>
</cfif>
</cfif>
<p>
<cfoutput>
<a href="code.txt" target="_blank">The Code</a>
</cfoutput>
</body>
</html>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application
http://www.houseoffusion.com/banners/view.cfm?bannerid=48
Message: http://www.houseoffusion.com/lists.cfm/link=i:15:1538
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/15
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:15
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54