superabbe
asked on
Form / Post Action suing combo box
Hello everybody...
My friend Babban asked this question but didn't got any answeres. Im curious myself.
Can I by using a a form, combobox and a send button post different actions letting the combo box control the action?
Let say my combobox have 3 values.
"Projects" (action=page1.asp)
"Programs" (action=page2.asp)
"Production" (action=page3.asp)
Is this possible in some way. This could be useful I think. Some trick or a solution that reminds of this?
Rgrds
My friend Babban asked this question but didn't got any answeres. Im curious myself.
Can I by using a a form, combobox and a send button post different actions letting the combo box control the action?
Let say my combobox have 3 values.
"Projects" (action=page1.asp)
"Programs" (action=page2.asp)
"Production" (action=page3.asp)
Is this possible in some way. This could be useful I think. Some trick or a solution that reminds of this?
Rgrds
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Try these changes:
Response.write "<option " & selstring & " value=""" & assign("DestinationPage") & """>" & assign("AssignToGroupName" )&
"</option>"
<input type="button" value="Send" onClick="this.form.action= this.form. Group.valu e;this.for m.submit() ;" name="button">
Response.write "<option " & selstring & " value=""" & assign("DestinationPage") & """>" & assign("AssignToGroupName"
"</option>"
<input type="button" value="Send" onClick="this.form.action=
ASKER
But AssignToGroupName holds values like
AABB
BBAA
CCDD
That must be trigged on the 'destination page'...
?
AABB
BBAA
CCDD
That must be trigged on the 'destination page'...
?
Oh, ok. As long as the url:s don't contain a semicolon (;), these additional changes should do it:
<input type="hidden" name="Group">
<select name="GroupList" size="1">
<input type="button" value="Send" onClick="this.form.action= this.form. GroupList. value;this .form.Grou p.value=th is.form.Gr oupList(th is.form.Gr oupList.se lectedInde x).text;th is.form.su bmit();" name="button">
<input type="hidden" name="Group">
<select name="GroupList" size="1">
<input type="button" value="Send" onClick="this.form.action=
Eh, forget that about the semicolon. That was from a different solution I had in mind.
<Script>
Function SomeFunction()
{
document.frm.action=docume nt.frm.opt ion.value;
document.frm.submit()
}
</Script>
<form name="frm" action=SomePage.asp>
<select name="option" OnChange=SomeFunction()>
<option value="page1.asp"> Option 1
<option value="page2.asp">Option 2
<option value="page3.asp">Option 3
</select>
</form>
Just check it for grammer ... this is the solutuion you needd.... but some small mistake of Comma and all may be there ... Alryte
Get Going
Mihir
Function SomeFunction()
{
document.frm.action=docume
document.frm.submit()
}
</Script>
<form name="frm" action=SomePage.asp>
<select name="option" OnChange=SomeFunction()>
<option value="page1.asp"> Option 1
<option value="page2.asp">Option 2
<option value="page3.asp">Option 3
</select>
</form>
Just check it for grammer ... this is the solutuion you needd.... but some small mistake of Comma and all may be there ... Alryte
Get Going
Mihir
Mihirl, yes, except you don't have a submit button. And if the user does not change the option, it does not go to the page of the default option. And superabbe needs the text of the options on the next page, that code doesn't do that.
Read the previous postings.
Read the previous postings.
ASKER
I think GreenGhost have a correct answere.
ASKER
I think GreenGhost have a correct answere.
mihirl, it is rude to lock up a question, especially when you are just repeating someone else's answer.
ASKER
Someone else was first.
Hey ! Buddy ... ity was by mistake .. i had no intentions of selecting answetr ....anyways ....
Thanx
Mihir
Thanx
Mihir
ASKER
Almost what I want.
Wait..I post my code here. I use SQL tabels.
I have added one field to my table named 'DestinationPage'.
How can I implement that to my code/combobox, that field should hold the post action information (example: page1.asp). It shall be hidden.
How can I then Post the value as I do here and also post the action to the destination in field 'DestinationPage'?
<form name="Selecthelpdesk">
<table border="0">
<tr>
<td>HELPDESK v 0.01</td>
</tr>
<tr>
<td class='headline'>Select helpdesk<br>
<select name="Group" size="1">
<%
set remoteconn=server.CreateOb
remoteconn.Open "Provider=SQLOLEDB.1;Drive
SQLstmt = "SELECT * from tblAssignToGroup"
Set assign = remoteconn.Execute(SQLstmt
selstring="selected"
While Not assign.EOF
Response.write "<option " & selstring & " value=""" & assign("AssignToGroupName"
selstring=""
assign.movenext
wend
%>
</select>
</td>
</tr>
<tr>
<td><b>
<input type="button" value="Send" onClick="this.form.submit(
</b></td>
</tr>
</table>
</form>