Question
dynamic data processing (concerning radio buttons)
hello again. first of all, whoever you are in my last topic,
thank you for helping me solve that checkbox problem. (forgot your
username)
here's a new puzzle:
this puzzle involved 2 pages, editMODS.cfm and editMODS2.cfm. in editMODS.cfm, there are 2 rows of radio buttons, one row for edit, one row for delete. but only one out of all can be checked at a time. once the user has selected whether he want to edit/delete that module, he will submit the value for editMODS2.cfm to process. editMODS2.cfm's responsibility is to check what the value submitted by editMODS.cfm is, then choose which page to redirect to. when the page is chosen, editMODS2.cfm should then pass the value passed by editMODS.cfm to that chosen page so that the chosen page can work its magic.
editMODS.cfm
===========
<cfquery datasource="fypdatabase" name="listMODS">
SELECT *
FROM moduleTABLE
ORDER BY courseID
</cfquery>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=" http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="editMODS2.cfm">
<table width="318" border="0" cellpadding="4" cellspacing="3">
<tr>
<td colspan="3" align="center"><strong>Edit / Delete Modules</strong></td>
</tr>
<tr>
<td align="left" valign="top"> </td>
<td align="center" valign="top"><strong>Edit</strong></td>
<td align="center" valign="top"><strong>Delete</strong></td>
</tr>
<cfloop query="listMODS">
<tr>
<td width="192" align="left" valign="top">
<cfoutput>#listMODS.moduleNAME# (#listMODS.moduleCODE#)</cfoutput> </td>
<td width="45" align="center" valign="top">
<cfoutput><input type="radio" name="radio" id="radio" value="E#listMODS.moduleID#" /></cfoutput> </td>
<td width="45" align="center" valign="top">
<cfoutput><input type="radio" name="radio" id="radio" value="D#listMODS.moduleID#" /></cfoutput> </td>
</tr></cfloop>
<tr>
<td height="3" colspan="3" align="center" valign="middle"></td>
</tr>
<tr>
<td colspan="3" align="center" valign="middle"><input type="submit" name="button" id="button" value="Submit" /></td>
</tr>
</table>
</form>
</body>
</html>
+++++++++++++++++++++
editMODS2.cfm (all those cfoutputs are there for faster testing of the checking function)
============
<cfquery datasource="fypdatabase" name="listMODS">
SELECT *
FROM moduleTABLE
ORDER BY courseID
</cfquery>
<cfif #form.radio# is "E#listMODS.moduleID#">
<cfoutput>rw</cfoutput>
<cfelseif #form.radio# is "D#listMODS.moduleID#">
<cfoutput>sd</cfoutput>
<cfelse>
<cfoutput>ec</cfoutput>
</cfif>
as a bonus, it will be greatly appreciated if anyone can enlighten me on value passing too.
here's a new puzzle:
this puzzle involved 2 pages, editMODS.cfm and editMODS2.cfm. in editMODS.cfm, there are 2 rows of radio buttons, one row for edit, one row for delete. but only one out of all can be checked at a time. once the user has selected whether he want to edit/delete that module, he will submit the value for editMODS2.cfm to process. editMODS2.cfm's responsibility is to check what the value submitted by editMODS.cfm is, then choose which page to redirect to. when the page is chosen, editMODS2.cfm should then pass the value passed by editMODS.cfm to that chosen page so that the chosen page can work its magic.
editMODS.cfm
===========
<cfquery datasource="fypdatabase" name="listMODS">
SELECT *
FROM moduleTABLE
ORDER BY courseID
</cfquery>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=" http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="editMODS2.cfm">
<table width="318" border="0" cellpadding="4" cellspacing="3">
<tr>
<td colspan="3" align="center"><strong>Edit / Delete Modules</strong></td>
</tr>
<tr>
<td align="left" valign="top"> </td>
<td align="center" valign="top"><strong>Edit</strong></td>
<td align="center" valign="top"><strong>Delete</strong></td>
</tr>
<cfloop query="listMODS">
<tr>
<td width="192" align="left" valign="top">
<cfoutput>#listMODS.moduleNAME# (#listMODS.moduleCODE#)</cfoutput> </td>
<td width="45" align="center" valign="top">
<cfoutput><input type="radio" name="radio" id="radio" value="E#listMODS.moduleID#" /></cfoutput> </td>
<td width="45" align="center" valign="top">
<cfoutput><input type="radio" name="radio" id="radio" value="D#listMODS.moduleID#" /></cfoutput> </td>
</tr></cfloop>
<tr>
<td height="3" colspan="3" align="center" valign="middle"></td>
</tr>
<tr>
<td colspan="3" align="center" valign="middle"><input type="submit" name="button" id="button" value="Submit" /></td>
</tr>
</table>
</form>
</body>
</html>
+++++++++++++++++++++
editMODS2.cfm (all those cfoutputs are there for faster testing of the checking function)
============
<cfquery datasource="fypdatabase" name="listMODS">
SELECT *
FROM moduleTABLE
ORDER BY courseID
</cfquery>
<cfif #form.radio# is "E#listMODS.moduleID#">
<cfoutput>rw</cfoutput>
<cfelseif #form.radio# is "D#listMODS.moduleID#">
<cfoutput>sd</cfoutput>
<cfelse>
<cfoutput>ec</cfoutput>
</cfif>
as a bonus, it will be greatly appreciated if anyone can enlighten me on value passing too.
