...

View Full Version : Checking to see what button the user pressed.



bsharif
09-09-2008, 08:19 PM
Hello to All,

I have a web page I am trying to create Its a form that allows users to enter in career information . The problem is that I have 1 row shown to the user at a time and when the user presses the (Add new) button, I want another row to appear to let the user enter more career information. I have figured out a way to do this using <cfif IsDefined("FORM.Add")> , But I don't want to send the form to the server, I just want to check the button and then add a new line without a form.submit, because right now I have 2 forms on the page. Is there anyway to check the button pressed without a form submit. Like is there a coldfusion check to see what button has been pressed.


sample code:


<cfform name="FormalSubmit" id="FormalSubmit" method="post" action="">

<table align="center" width="760" border="2" cellspacing="1" cellpadding="2" summary="summary">

<tr><td colspan="100" bgcolor="##000066" style="color: white; text-align: left;"><strong> FORMAL EDUCATION</strong></td></tr>
<tr>
<td nowrap style="color: black;text-align: left; "><strong>Name of Institution and City/State</strong> </td>
<td style="color: black; text-align: left;"><strong>Field(s) of Study</strong>
</td>
<td nowrap style="color: black; text-align: left;"><strong>Years Attended</strong></td>
<td nowrap style="color: black; text-align: left;"><strong>Degree</strong> </td>
<td>&nbsp;</td>
</tr>

<tr>
<td ><cfinput name="Institution" value= "#Institution#" type="text" size="40" maxlength="50" required="yes" message="Please enter your Institution."></td>
<td >
<cfinput name="Study" value= "#Study#" type="text" size="25" maxlength="50" required="yes" message="Please enter your Field of Study.">
</td>
<td>
<cfinput name="Attended" value= "#Attended#" type="text" size="15" maxlength="50" required="yes" message="Please enter years attended.">
</td>
<td >
<cfinput name="Degree" value= "#Degree#" type="text" size="30" maxlength="50" required="yes" message="Please enter your degree.">

</td>
<td >
<input type="submit" value="Add New" name="Add">
</td>
</tr>

<cfif IsDefined("FORM.Add")>
<tr>
<td ><cfinput name="Institution2" value= "#Institution#" type="text" size="40" maxlength="50" required="yes" message="Please enter your Institution."></td>
<td >
<cfinput name="Study2" value= "#Study#" type="text" size="25" maxlength="50" required="yes" message="Please enter your Field of Study.">
</td>
<td>
<cfinput name="Attended2" value= "#Attended#" type="text" size="15" maxlength="50" required="yes" message="Please enter years attended.">
</td>
<td >
<cfinput name="Degree2" value= "#Degree#" type="text" size="30" maxlength="50" required="yes" message="Please enter your degree.">

</td>
<td >
<input type="submit" value="Add New" name="Add">
</td>
</tr>
</cfif>
</cfform>
</table>





Thank you.

kjab
11-06-2008, 08:12 AM
That sounds like a javascript or ajax solution



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum