Connecting Tech Pros Worldwide Forums | Help | Site Map

radio buttons and element not defined error

Newbie
 
Join Date: Jul 2007
Posts: 10
#1: Oct 7 '08
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 "viewReportButton" 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's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#2: Oct 7 '08

re: radio buttons and element not defined error


Can you post some of your code?
Newbie
 
Join Date: Jul 2007
Posts: 10
#3: Oct 7 '08

re: radio buttons and element not defined error


Thank you very much for your reply.

In detail report:

Expand|Select|Wrap|Line Numbers
  1.     <cfform name="detailform" action="/Ecoater/AuditReport.cfm" method="post">
  2.                 <cfloop index="i" from="1" to="#getCoilDetail.RecordCount#">
  3.                     <cfif (i mod 2) is 0>
  4.                         <cfset databgcolor = "e8e8e8">
  5.                     <cfelse>
  6.                         <cfset databgcolor = "f9f9f9">
  7.                     </cfif>
  8.                 <cfset databgcolor = "##" & databgcolor>
  9.  
  10.         <tr align="right" class="data" bgcolor="<cfoutput>#databgcolor#</cfoutput>">
  11.             <td align="center"><a href="/Ecoater/CoilInquirySearchAction.cfm?coilNumFromDetailReport=<cfoutput>#getCoilDetail.coil_number[i]#</cfoutput>">
  12.                 <cfoutput>#getCoilDetail.coil_number[i]#</cfoutput></a></td>
  13.             <td><cfoutput>#NumberFormat(getCoilDetail.actual_weight[i])#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</cfoutput></td>
  14.             <td><cfoutput>#NumberFormat(getCoilDetail.tmw_weight[i])#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</cfoutput></td>
  15.             <td><cfoutput>#NumberFormat(getCoilDetail.lineal_footage[i])#&nbsp;&nbsp;&nbsp;&nbsp;</cfoutput></td>
  16.             <td><div align="right"><cfoutput>#getCoilDetail.customer_po_number[i]#&nbsp;&nbsp;&nbsp;&nbsp;</cfoutput></div></td>
  17.             <td><div align="center"><cfoutput>#getCoilDetail.mill_coil_number[i]#</cfoutput></div></td>
  18.             <td><div align="center"><cfoutput>#getCoilDetail.mill_number[i]#</cfoutput></div></td> 
  19.             <!--- jfu 09/05/06 add DateFormat --->
  20.             <td><div align="center"><cfoutput>#getCoilDetail.receiveDate[i]#</cfoutput></div></td>
  21.             <td><div align="center"><cfoutput>#getCoilDetail.location[i]#</cfoutput></div></td>
  22.             <td><cfoutput>#getCoilDetail.shop_order_number[i]#&nbsp;&nbsp;</cfoutput></td>
  23.             <td><cfoutput>#getCoilDetail.skid[i]#&nbsp;&nbsp;</cfoutput></td>
  24.             <td align=center><cfinput type="radio" name="viewReportbutton" value="#getCoilDetail.coil_number[i]#" required="yes" message="Please selected a coil to view audit report." > 
  25.                     </td>
  26.         </tr>                
  27.             </cfloop>
  28.  
  29.             <tr><Td colspan=12 align=right valign=middle style="padding-top:3"><cfinput type=submit name="submitButton" value="View Audit Report" >
  30.             </Td>
  31.             </tr>
  32.             </cfform>
  33.             <tr><Td colspan=12>&nbsp;</Td></tr>
  34.  
------------ in audit report -----------

Expand|Select|Wrap|Line Numbers
  1. <cfset coilnumber = '#form.viewReportbutton#'>
error happends here.
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#4: Oct 7 '08

re: radio buttons and element not defined error


Set form.viewReportbutton 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.
Newbie
 
Join Date: Jul 2007
Posts: 10
#5: Oct 7 '08

re: radio buttons and element not defined error


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.
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#6: Oct 7 '08

re: radio buttons and element not defined error


Can you give the rest of the code in the audit report page.
Newbie
 
Join Date: Jul 2007
Posts: 10
#7: Oct 7 '08

re: radio buttons and element not defined error


Here it is. Thank you.

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <html>
  3.  
  4. <head>
  5.  
  6.     <title>Coil Information Audit Report</title>
  7.  
  8.  
  9. </head>
  10.  
  11. <body>
  12.  
  13. <cfparam name="FORM.viewReportbutton" default="">
  14.  
  15.  
  16. <cfset coilnumber = "#Form.viewReportbutton#">
  17. <cfset basecoilnumber = mid(coilnumber,1,7)>
  18.  
  19. <cflock timeout="10" throwontimeout="No" type="EXCLUSIVE" scope="SESSION">
  20.         <cfquery name="getAuditcoil" datasource="webs" dbtype="Oracle80">
  21.  
  22.             select * from audit_sample  where base_coil_number = '#basecoilnumber#'
  23.  
  24.         </cfquery>
  25.  
  26. </cflock>
  27.  
  28.  
  29.  
  30. <table width="720" cellspacing="2" cellpadding="2" border="0">
  31. <tr>
  32.     <td>
  33.     <cflock timeout="10" throwontimeout="No" type="READONLY" scope="SESSION">
  34.         <cfif #getAuditcoil.RecordCount# neq 0>
  35.         <br>
  36.         <div align="center" class="type">COIL AUDIT REPORT FOR&nbsp;BASE COIL NUMBER&nbsp <b><cfoutput>#basecoilnumber#</cfoutput></b></div>
  37.         <br>
  38.         <table width="720" border="0" cellspacing="1" cellpadding="1" >
  39.         <tr>
  40.             <td colspan="16" bgcolor="#000033" >&nbsp;</td>
  41.         </tr>
  42.  
  43.  
  44.         <tr bgcolor="#849ebb" class="coilHeader" align="right">
  45.                 <td align="center">Coil Number</td>
  46.                 <td align="center">Trans. Date</td>
  47.  
  48.                             </tr>
  49.  
  50.             <cfloop index="i" from="1" to="#getAuditcoil.RecordCount#">
  51.                 <tr class="data" bgcolor="#f9f9f9">
  52.                     <td nowrap><cfoutput>#getAuditcoil.coil_number[i]#</cfoutput></td>
  53.                     <td nowrap><cfoutput>#DateFormat(getAuditcoil.transaction_date[i],"dd-mmm-yyyy")#</cfoutput></td>
  54.  
  55.                 </tr>
  56.  
  57.             </cfloop>
  58.  
  59.             <tr>
  60.             <td colspan="16" bgcolor="#000033" >&nbsp;</td>
  61.             </tr>
  62.             </table>    
  63.  
  64.             <cfelse>
  65.             <p>&nbsp;</p>
  66.                 <font face="Arial" SIZE="2">Cannot find audit information for this coil in the audit table</font>
  67.  
  68.             </cfif></cflock>
  69. </td>
  70. </tr>
  71. <tr><td><p>&nbsp;</p></td></tr>
  72. </table>
  73. </body>
  74. </html>
  75.  
  76.  
  77.  
  78.  
  79.  
acoder's Avatar
Site Moderator
 
Join Date: Nov 2006
Location: UK
Posts: 14,581
#8: Oct 8 '08

re: radio buttons and element not defined error


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:
Expand|Select|Wrap|Line Numbers
  1. <form name="detailform" action="/Ecoater/AuditReport.cfm" method="post">
  2.     <cfloop index="i" from="1" to="42">
  3. <input type="radio" name="viewReportbutton" value="somevalue<cfoutput>#i#</cfoutput>">
  4.     </cfloop>
  5. </form>
Reply


Similar ColdFusion bytes