Forum Moderators: open

Message Too Old, No Replies

Is it possible to have 2 FORM tags?

...arh.

         

vanjamier

2:54 am on Jan 5, 2005 (gmt 0)

10+ Year Member



Hi, I have a problem using my "find" BUTTON. It doesnt respond...
i have 2 submit btn's so i decided to use 2 forms
It appears the problem isnt solve tht easy..

Please kindly take a look at my code and let me know my mistake cuz i dont..
Thanks in advance.


<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Include/connection.asp"-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<SCRIPT LANGUAGE="JavaScript">
function checkEmail(form1) {
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(form1.owneremail.value)){
return (true)
}
alert("Invalid E-mail Address! Please re-enter.")
return (false)
}
</script>
</head>

<body onload="document.form2.swname.value=document.form2.option1.options[document.form2.option1.selectedIndex].value">
<form method="post" enctype="multipart/form-data" action="Insert_data.asp" name=form1 onSubmit="return checkEmail(this)">
<table width="80%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td><b>Item</b></td>
<td><b>Entries</b></td>
</tr>
<tr>
<td>Software Owner :</td>
<td><input name="ownername" size="40" ></td>
</tr>
<tr>
<td>Software Email :</td>
<td><input name="owneremail" size="40" ></td>
</tr>
<tr>
<td>Software name :</td>
<td><input name="swname" size="18">
<form method="post" action="license_add.asp" name=form2>
<input type="submit" name="Submit2" id="Submit3" value="Find"></td>
</tr>
<%
If Request.Form("Submit2") = "Find" Then
description = Request.Form("swname")

set rs=Server.CreateObject("ADODB.Recordset")

sql= "select id,description from standard_sw where description like '" & description & "%'" &_
" union " &_
" select id,name from legacy_sw where name like '" & description & "%'"

rs.Open sql,connStr

response.write "<select id='option1' size='1' name='option1' onchange='this.form.text1.value=this.options[this.selectedIndex].value'>"
while not rs.EOF
response.write("<option value='")
response.write(rs.fields("description"))
response.write("'")

if rs.fields("description")= description then
response.write("selected")
end if

response.write(">")
response.write(rs.fields("description"))
response.write("</option>")

rs.MoveNext
wend

response.write "</select>"
rs.Close
set rs=Nothing
End if
%>
</form>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Submit" id=submit1 name=submit1 onclick="verify();"></td>
</tr>
</table>
</form>
</body>
</html>


Thanks in advance

vanjamier

3:10 am on Jan 5, 2005 (gmt 0)

10+ Year Member



I have removed my tags cuz i read in the book, we cant nest Form tags..

How do i solve my Find submit btn now?
It doesnt respond...

txbakers

1:16 pm on Jan 5, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can have many forms on a page, just not nested.

You will have to pass your parameteres into each form if you want to pass parameteres.

Lots of sites have many forms on one page.

too much information

1:24 pm on Jan 5, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can also have multiple submit buttons for a single form. Give each button a value and name all of them the same, when the form is submitted check to see which button was used and go from there.