|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
[Classic ASP] about request.form
can i specify which request form that i want to process...
maybe like this : if Not IsEmpty(Request.Form("test2")) then ... end if sorry for the bad english here's my code : Code:
<%
if Not IsEmpty(Request.Form) then
response.write(request.form("text1"))
response.write("<br> + <br>")
response.write(request.form("text2"))
end if
%>
<body>
<table id="table1">
<tr>
<td>
<form id="test1" action="" method="post">
<input id="text1" name="text1" type="Text">
<input id="button1" type="button" value="button" onclick="javascript:document.getElementById('test1').submit ();">
</form>
</td>
</tr>
</table>
<br>
<hr>
<br>
<table id="table2">
<tr>
<td>
<form id="test2" action="" method="post">
<input id="text2" name="text2" type="text">
<input id="button2" type="button" value="button" onclick="javascript:document.getElementById('test2').submit ();">
</form>
</td>
</tr>
</table>
</body>
|
|
#2
|
||||
|
||||
|
--> Moved to ASP Forum
You can check to see if the Request.Form collection contains values and then test the length of each value, eg: Code:
<%
Dim whichValue
If Request.Form.Count > 0 Then
If Len(Trim(Request.Form("text1"))) > 0 Then
whichValue = Request.Form("text1")
Else
whichValue = Request.Form("text2")
End If
End If
%>
What exactly do you need to do? |
|
#3
|
|||
|
|||
|
i want to give specific process for each form submitted
something like this if (form1 submitted) then do process x end if if (form2 submitted) then do process y end if the problem is when i use if(request.form) <-- i want this to respond to specific form only |
|
#4
|
||||
|
||||
|
You could use submit buttons to submit teh forms and then test the value of the submit button, eg:
Code:
<html>
<%
If Request.Form("btnsubmit") = "Submit Form 1" Then
'Form 1 submitted
Else
'Form 2 Submitted
End IF
%>
<body>
<table id="table1">
<tr>
<td>
<form name="test1" id="test1" action="test2.asp" method="post">
<input id="text1" name="text1" type="Text">
<input type="submit" value="Submit Form 1" name="btnSubmit">
</form>
</td>
</tr>
</table>
<br>
<hr>
<br>
<table id="table2">
<tr>
<td>
<form name="test2" id="test2" action="test2.asp" method="post">
<input id="text2" name="text2" type="text">
<input type="submit" value="Submit Form 2" name="btnSubmit">
</form>
</td>
</tr>
</table>
</body>
|
|
#5
|
|||
|
|||
|
aaah~
your right, thats what i needed, however, can i used hyperlink instead of button to do that? btw thx sync_or_swim |
|
#6
|
||||
|
||||
|
Quote:
You're welcome, glad it helped!! With regards using a hyperlink, I dont think that is possible but one option would be to style your buttons to look like links: Code:
<html>
<style type="text/css">
.button-link
{
cursor: hand;
border: none;
background-color: transparent;
text-decoration: underline;
padding: 0;
}
.link
{
color: blue;
font-size: 1em;
font-weight: normal;
font-family: Arial;
}
</style>
<%
If Request.Form("btnsubmit") = "Submit Form 1" Then
'Form 1 submitted
Else
'Form 2 Submitted
End IF
%>
<body>
<table id="table1">
<tr>
<td>
<form name="test1" id="test1" action="test2.asp" method="post">
<input id="text1" name="text1" type="Text">
<input type="submit" value="Submit Form 1" name="btnSubmit" class="button-link link">
</form>
</td>
</tr>
</table>
<br>
<hr>
<br>
<table id="table2">
<tr>
<td>
<form name="test2" id="test2" action="test2.asp" method="post">
<input id="text2" name="text2" type="text">
<input type="submit" value="Submit Form 2" name="btnSubmit" class="button-link link">
</form>
</td>
</tr>
</table>
</body>
|
|
#7
|
|||
|
|||
|
lol, and here i am thinking that making it into hyperlink would
make it simpler i guess i'll stick to the button then thx again sync_or_swim |
|
#8
|
||||
|
||||
|
Quote:
You're welcome, glad it helped!! ![]() |
![]() |
| Viewing: ASP Free Forums > Programming > ASP Development > [Classic ASP] about request.form |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|