Create an easy form that submit the contains to another page.

The submit form:
Everything that we wont to submit must be between the <form>..</form> tags.
First we create a text area for "First Name". (type="text") and set size of the form to 20 characters and maxlength to 20. We do the same with Last Name.
At the end of the form we create the submit button. When the user click this button, the submit form action runs and open the page we want to receive data. In this example form2.cfm.

form1.cfm

<form action="form2.cfm" method="post" name="form1">

First Name:<input name="first_name" type="text" size="20" maxlength="20">

<br>

Last Name:<input name="last_name" type="text" size="20" maxlength="20">

<br>

<input name="upload_person" type="submit" id="upload_person" value="Submit -->">

</form>

<form action="form2.cfm" The page that receives data from the submit form:
To output the submitted data we use <cfoutout>#Form.first_name#</cfoutput>

form2.cfm

First Name: <cfoutput>#Form.first_name#</cfoutput>

<br>

Last Name: <cfoutput>#Form.last_name#</cfoutput>

How to check if the user have type information in the text field.

Change the <form>?</form> tag to ColdFusion Form.
<cfform>?.</cfform>
Cange the <input> tag to ColdFusion input.
<cfinput?..>

Then set required to ?Yes?, and enter the message that will show up if the user left the text area empty.

You only have to change form1.cfm like this:

<cfform action="form2.cfm" method="post" name="form1">

First Name:<cfinput name="first_name" type="text" size="20" maxlength="20" required="yes" message="Please enter First Name.">

<br>

Last Name:<cfinput name="last_name" type="text" size="20" maxlength="20" required="yes" message="Please enter Last Name.">

<br>

<input name="upload_person" type="submit" id="upload_person" value="Submit -->">

</cfform>


 

Advertisement

User Comments: 2

 Make a button that would act like the back button on a web browser.

The easiest way to do this is to make a back button to the form so the user can correct what have been submitted.

To do this, make a button in the form2.cfm page.

<input name="Correct" type="button" onClick="history.back(-1)" value="Correct">  

(This kind of back button would act like the back button on a web browser.)

Regards
Webmaster

 How to making changes to submitted contains?

I was wondering if a user fills out the information then goes to the second page and then decides to edit just one field (i.e. first name) can there be an edit button right next to the field that the user presses and then can be allowed to changed that one field and submit the form to the page to view his changes again?

ApplayIT is owned by Scandic Systems LTD [UK] Company No. 5984000. All other trademarks and copyrights are the property of their respective holders.