Hey Adam,

There are a couple of issues here that I see.

1.  checkboxes are grouped by their name.  if you have 3 different names for 
the check boxes, then they won't be in the same variable.  This may be a 
non-issue for you, but it leads into #3.
2.  form names cannot have spaces in them.  if you need a visual 'space' you 
can use hyphens or underscore.
2.  your insert statement has a couple of issues.
    a.  since you have multiple choices for the judge, you would need to loop 
over your results.  either by a defined list (judge_1, judge_2,judge_3) or a 
variable list (#form.judge#)  (variable list would releate to #1 above where 
you change the name of the checkboxes to just 'judge' and the values would be 
sent as a comma dilem list)
    b.  insert statements don't use the 'where' clause, because an insert 
statement assumes the row doesn't exist yet.  If you are trying to 'change' the 
value in the row, then you would use update, otherwise insert creates a new row.
    c.  be cautious with checkboxes, radio buttons, and select boxes.  if there 
are no selections in those types of fields, then the receiving page does not 
recieve a value for the variable.  example... if someone shift+clicks the judge 
1 checkbox and doesn't select another checkbox on the screen, then 
form.judge[_1] won't exist on the receiving page.  most instances of this type 
of situation would indicate you should <cfparam> the form var so that it won't 
be an issue.

hope this helpls,
William



----------
William E. Seiter


On Jan 24, 2011, Adam Parker <[email protected]> wrote: 


When assigning judges to review poems, can I use this table to hold the data of 
which judges review which poems and the rates they give the poems?

Right now, the form simply lists judges 1-3:
<form
        action="#cgi.SCRIPT_NAME#"
        method="post"
        enctype="multipart/form-data">
        <!--- Our form submission flag. --->
        <input type="hidden" name="submitted" value="1" />
        <input type="hidden" value="#poemid#" />
        <label class="block" for=""><input name="Judge 1" id="userid1" 
checked="checked" type="checkbox">Judge 1</label>
        <label class="block" for=""><input name="Judge 2" id="userid2" 
type="checkbox">Judge 2</label>
        <label class="block" for=""><input name="Judge 3" id="userid3" 
type="checkbox">Judge 3</label>
        <div align="center">
        <input class="dlgButton" value="Done" type="submit">
        </div>
</form>

Since there are only 3 judges, it seems like hardcoding the names wouldn't be 
too bad.

When the forms submits, I use:
        <cfquery name="updateJudge" datasource="#request.dsn#">
        INSERT INTO PoetryJudges (poemID, judge) 
        VALUES (#form.poemid#, '#form.judge1#')
        WHERE ID = #form.poemid#
        </cfquery>              

How would I handle the event where more than one judge is assigned a poem? 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:5213
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-newbie/unsubscribe.cfm

Reply via email to