radio buttons and element not defined error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gengyue
    New Member
    • Jul 2007
    • 10

    radio buttons and element not defined error

    Hi,

    I am running a report using Cold Fusion. This report is generated by cfloop tag. Depends on the record count of a query, the report will list the data retrieved from the database. each row in the report will have a radio button, so there may be lots of radio buttons in this report. These radio buttons are defined in a form tag. User will select a radio button and then click a submit button to an action page to show more detail information.

    The funky thing happens if I select first six or five buttons, I got either "page cannot displayed" or "save a file" window opened. I refreshed page and got error message tells me the radio button "viewReportButt on" is not defined in the form. However, when I select other radio buttons, I got through. All the radio buttons have the same name but with different values.

    If I have less radio buttons in the form, no such weird case happens. I tested it. When I have 42 or 46 radio buttons, I got the error.

    Can anybody here tell me what's the problem? Thank you very much.
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Can you post some of your code?

    Comment

    • gengyue
      New Member
      • Jul 2007
      • 10

      #3
      Thank you very much for your reply.

      In detail report:

      Code:
      	<cfform name="detailform" action="/Ecoater/AuditReport.cfm" method="post">
      				<cfloop index="i" from="1" to="#getCoilDetail.RecordCount#">
      					<cfif (i mod 2) is 0>
      						<cfset databgcolor = "e8e8e8">
      					<cfelse>
      						<cfset databgcolor = "f9f9f9">
      					</cfif>
      				<cfset databgcolor = "##" & databgcolor>
      				
      		<tr align="right" class="data" bgcolor="<cfoutput>#databgcolor#</cfoutput>">
      			<td align="center"><a href="/Ecoater/CoilInquirySearchAction.cfm?coilNumFromDetailReport=<cfoutput>#getCoilDetail.coil_number[i]#</cfoutput>">
      				<cfoutput>#getCoilDetail.coil_number[i]#</cfoutput></a></td>
      			<td><cfoutput>#NumberFormat(getCoilDetail.actual_weight[i])#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</cfoutput></td>
      			<td><cfoutput>#NumberFormat(getCoilDetail.tmw_weight[i])#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</cfoutput></td>
      			<td><cfoutput>#NumberFormat(getCoilDetail.lineal_footage[i])#&nbsp;&nbsp;&nbsp;&nbsp;</cfoutput></td>
      			<td><div align="right"><cfoutput>#getCoilDetail.customer_po_number[i]#&nbsp;&nbsp;&nbsp;&nbsp;</cfoutput></div></td>
      			<td><div align="center"><cfoutput>#getCoilDetail.mill_coil_number[i]#</cfoutput></div></td>
      			<td><div align="center"><cfoutput>#getCoilDetail.mill_number[i]#</cfoutput></div></td> 
      			<!--- jfu 09/05/06 add DateFormat --->
      			<td><div align="center"><cfoutput>#getCoilDetail.receiveDate[i]#</cfoutput></div></td>
      			<td><div align="center"><cfoutput>#getCoilDetail.location[i]#</cfoutput></div></td>
      			<td><cfoutput>#getCoilDetail.shop_order_number[i]#&nbsp;&nbsp;</cfoutput></td>
      			<td><cfoutput>#getCoilDetail.skid[i]#&nbsp;&nbsp;</cfoutput></td>
      			<td align=center><cfinput type="radio" name="viewReportbutton" value="#getCoilDetail.coil_number[i]#" required="yes" message="Please selected a coil to view audit report." > 
      					</td>
      		</tr>				
      			</cfloop>
      			
      			<tr><Td colspan=12 align=right valign=middle style="padding-top:3"><cfinput type=submit name="submitButton" value="View Audit Report" >
      			</Td>
      			</tr>
      			</cfform>
      			<tr><Td colspan=12>&nbsp;</Td></tr>
      ------------ in audit report -----------

      Code:
      <cfset coilnumber = '#form.viewReportbutton#'>
      error happends here.
      Last edited by acoder; Oct 7 '08, 08:09 PM. Reason: Added [code] tags

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        Set form.viewReport button to a default value using cfparam. I'm not sure what could be causing the error, but you should try that to begin with. If that doesn't help, try without cfinput, i.e. using normal input elements.

        PS. please use code tags when posting code. Thanks.

        Comment

        • gengyue
          New Member
          • Jul 2007
          • 10

          #5
          Hi,

          I tried both way and still get the same error. What puzzles me is that all the radio buttons generated from the same loop. Some radio buttons' values are submitted while some are not with value undefined. I don't know why. Even in undefined error, I got two different scenarioes. One is give me "page cannot display"; if I refresh, I can see the detail error message; the other gives me pop up window to ask me save or open the file, and then I can see 500 internal error.

          Please help.

          Thanks.

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #6
            Can you give the rest of the code in the audit report page.

            Comment

            • gengyue
              New Member
              • Jul 2007
              • 10

              #7
              Here it is. Thank you.

              Code:
              <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
              <html>
              
              <head>
              
              	<title>Coil Information Audit Report</title>
              
              
              </head>
              
              <body>
              
              <cfparam name="FORM.viewReportbutton" default="">
              
              	
              <cfset coilnumber = "#Form.viewReportbutton#">
              <cfset basecoilnumber = mid(coilnumber,1,7)>
              
              <cflock timeout="10" throwontimeout="No" type="EXCLUSIVE" scope="SESSION">
              		<cfquery name="getAuditcoil" datasource="webs" dbtype="Oracle80">
              
              			select * from audit_sample  where base_coil_number = '#basecoilnumber#'
              
              		</cfquery>
              
              </cflock>
              
              
              
              <table width="720" cellspacing="2" cellpadding="2" border="0">
              <tr>
                  <td>
              	<cflock timeout="10" throwontimeout="No" type="READONLY" scope="SESSION">
              		<cfif #getAuditcoil.RecordCount# neq 0>
              		<br>
              		<div align="center" class="type">COIL AUDIT REPORT FOR&nbsp;BASE COIL NUMBER&nbsp <b><cfoutput>#basecoilnumber#</cfoutput></b></div>
              		<br>
              		<table width="720" border="0" cellspacing="1" cellpadding="1" >
              		<tr>
              			<td colspan="16" bgcolor="#000033" >&nbsp;</td>
              		</tr>
              		
              		
              		<tr bgcolor="#849ebb" class="coilHeader" align="right">
              				<td align="center">Coil Number</td>
              				<td align="center">Trans. Date</td>
              
              							</tr>
              			
              			<cfloop index="i" from="1" to="#getAuditcoil.RecordCount#">
              				<tr class="data" bgcolor="#f9f9f9">
              					<td nowrap><cfoutput>#getAuditcoil.coil_number[i]#</cfoutput></td>
              					<td nowrap><cfoutput>#DateFormat(getAuditcoil.transaction_date[i],"dd-mmm-yyyy")#</cfoutput></td>
              					
              				</tr>
              				
              			</cfloop>
              			
              			<tr>
              			<td colspan="16" bgcolor="#000033" >&nbsp;</td>
              			</tr>
              			</table>	
              
              			<cfelse>
              			<p>&nbsp;</p>
              				<font face="Arial" SIZE="2">Cannot find audit information for this coil in the audit table</font>
              
              			</cfif></cflock>
              </td>
              </tr>
              <tr><td><p>&nbsp;</p></td></tr>
              </table>
              </body>
              </html>
              Last edited by acoder; Oct 8 '08, 06:38 AM. Reason: Fixed code tags

              Comment

              • acoder
                Recognized Expert MVP
                • Nov 2006
                • 16032

                #8
                Hmm, either I'm missing something simple or this is a strange problem.

                OK, to eliminate the possibility of a problem from the client-side, try this code in your detail report page:
                Code:
                <form name="detailform" action="/Ecoater/AuditReport.cfm" method="post">
                	<cfloop index="i" from="1" to="42">
                <input type="radio" name="viewReportbutton" value="somevalue<cfoutput>#i#</cfoutput>">
                	</cfloop>
                </form>

                Comment

                Working...