Current location: Hot Scripts Forums » Programming Languages » Other Languages » Coldfusion Radio button


Coldfusion Radio button

Reply
  #1 (permalink)  
Old 03-02-09, 12:44 PM
figuervj figuervj is offline
New Member
 
Join Date: Mar 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Question Coldfusion Radio button

Currently we have 1 person updating staff profiles from our company. Recently they asked me to add a new field titled: Global Public Health Experience. Basically I added the section and radio buttons indicating a Yes or No answer. Everything on that page is saved onto a MySQL database, which I respectively also created a new section for the new field.

Once I did everything and ran a test I realized it was reading the database fine but not updating it if the answer changed from Yes to No or vice-versa. I changed the answer in the database itself and it updated perfectly but when i try to update it via the form, event though I don't get any error messages, it doesn't apply the updates onto the database.

Here's everything I have.

First I run the SQL query that updates database (what you see in bold is the section for this new field):
<cfquery name="bioupdate" datasource="sph_Edit">
UPDATE tblpersonnel
SET tblPers_FirstName='#firstname#', tblPers_LastName='#lastname#', tblPers_MI='#MI#', tblPers_PositionTitle='#positiontitle#',
tblPers_ExpandedTitle='#ExpandedTitle#', tblPers_Building='#building#', tblPers_Room='#room#', tblPers_Tel='#phone#',
tblPers_Email='#email#', tblPers_Fax='#fax#', tblPers_ExtAddress='#alternateaddress#', tblPers_Campus_fk='#campus#',
tblPers_ResearchInterests='#researchinterests#',tb lPers_DegreesCerts='#degreescerts#',
tblPers_ProfessionalService='#professionalservice# ', tblPers_CommunityService='#communityservice#',
tblPers_PublicationsLinks='#publicationslinks#',
tblPers_ImageLocation='#ImageUploadFileName#', tblPers_CVLocation='#CVUploadFileName#',
tblPers_Credentials='#Credentials#', tblPers_Dept_fk='#department#', tblPers_unit_fk='#unit1#', tblPers_unit2_fk='#unit2#',
tblPers_unit3_fk='#unit3#', tblPers_unittitle='#unit1title#', tblPers_unit2title='#unit2title#',
tblPers_unit3title='#unit3title#', tblPers_Ethnicity_fk='#ethnicity#', tblPers_Gender='#gender#',
tblPers_TenureStatus='#tenurestatus#', tblPers_Effort='#effort#', tblPers_FacultyRank_ID_fk='#facultyrank#',
tblPers_AppointmentDate='#DateFormat(appointmentda te, "yyyy-mm-dd")#',
tblPers_AppointmentType_ID_fk='#appointmenttype#', tblPers_Type='#type#', tblPers_PrimAfil='#primaryaffiliation#', tblPers_gphe='#gphe#'
WHERE tblPers_ID_pk='#URL.tblPers_ID_pk#'
</cfquery>


Then I have a query reading the database (the bold is for the new field):
<cfquery name="bio" datasource="sph_Read">
SELECT * from tblpersonnel WHERE tblPers_ID_pk='#URL.tblPers_ID_pk#'
</cfquery>

<!-- Set Paramaters -->
<cfset bioStruct=StructNew()>
<cfset bioStruct.gpheY="no" >
<cfset bioStruct.gpheN="no" >



Then I created conditions to select the correct answer on the form:
<cfif #bio.tblPers_gphe# EQ 'y'>
<cfset bioStruct.gpheY="yes">
<cfelse>
<cfset bioStruct.gpheN="yes">
</cfif>



Finally here's the field itself (nothing bold here, it's all for the new field):
<div class="inputtitlelong">Global Public Health Experience</div>

<div align="center" class="htmlinputlong2" id="gphexperience">
<cfinput name="gphe" type="radio" required="yes" message="Please indicate if this member has Global Public Health Experience" value="y" checked="#bioStruct.gpheY#" />Yes

<cfinput name="gphe" type="radio" value="n" checked="#bioStruct.gpheN#" />No
</div>


Please, if you notice something's wrong let me know. I've been struggling with this issue for some time now and still can't figure out what the heck is causing it not to work. Thanks for all your help in advance!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 07-25-09, 02:08 AM
viviotech's Avatar
viviotech viviotech is offline
Newbie Coder
 
Join Date: Jul 2009
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
At first glance I don't see anything wrong with your code. If I had to guess, I'd say that the reason your update isn't working is because the WHERE clause isn't returning any results. If the WHERE clause doesn't match anything, the the SQL statement will run without error, but nothing will get updated because nothing matched the update condition.

Hope this helps!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Expanding Table with a Radio Button sccc2008 JavaScript 1 11-04-07 01:27 AM
Radio Button redirect jumbo1 JavaScript 2 11-02-06 08:37 PM
two radio button and one text area zoliky JavaScript 1 09-15-06 04:44 AM
SQL/Coldfusion radio button problem..... Clark_Kent Other Languages 1 07-19-06 05:43 PM
radio button selection TheLaughingBandit ASP 3 08-31-03 07:22 PM


All times are GMT -5. The time now is 08:58 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.