Sri10
asked on
Coldfusion multiple forms in one page
Hi friends,
I have created a form with 3 fileds empno, empname, sal and a submit button.
empname and sal fields are read only. one can only enter empno and click submit.
When I enter existing empno in the text field and click on SUBMIT, the query should retrieve corresponding values from table and display in the remaining form fileds..
my table has 3 columns. empno, empname, sal.
until retrieval part, I have done(below code), but after retrieving how do I display values in the remaining fileds..
I have created a form with 3 fileds empno, empname, sal and a submit button.
empname and sal fields are read only. one can only enter empno and click submit.
When I enter existing empno in the text field and click on SUBMIT, the query should retrieve corresponding values from table and display in the remaining form fileds..
my table has 3 columns. empno, empname, sal.
until retrieval part, I have done(below code), but after retrieving how do I display values in the remaining fileds..
<cfif isdefined("form.view")>
<cfquery name="bbb" datasource="site4">
select * from emp where empno = #form.empno2#
</cfquery>
<cfoutput query="bbb"> #empname# </cfoutput>
<cfabort>
<cfelse>
<form id="form2" name="form2" method="post" action="test1.cfm">
<p>
<label>Emp No
<input type="text" name="empno2" id="empno2" />
</label>
</p>
<p>
<label>Emp Name
<input name="empname2" type="text" id="empname2" readonly="readonly" />
</label>
</p>
<p>
<label>Salary
<input name="sal2" type="text" id="sal2" readonly="readonly" />
</label>
</p>
<p>
<label>
<input type="submit" name="view" id="view" value="Submit" />
</label>
</p>
</form>
</cfif>
you may wanto consider using AJAX for this, so once you enter the value into the first field it will prepopulate the values into the rest
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.