Click to See Complete Forum and Search --> : Popup value creates hidden input value. Help!


SoCalMacDude
03-25-2003, 02:43 PM
Hi,
Is there a script available where the user makes a selection from the popup list, then, based on their choice, a hidden input tag is generated or populated?

Specifically, I have about 12 choices in the popup, and I need to specify which "results page" to return, based on their choice.

On Scriptsearch I find many menu type scripts, but I have not found one to solve this problem. (I'm sure it's a no-brainer for you "Scriptologists!")

Thanks for any help!

Ken

Jona
03-25-2003, 04:26 PM
Before I go and make all this code, let me verify what you want... You have index.html (page one) that opens a new window with a form in it. You want the new window to send the form data to the index.html page using JavaScript, and populate the value of an <INPUT TYPE="hidden"> tag?

SoCalMacDude
03-25-2003, 07:04 PM
Actually, it is an html page communicating through lasso to a Filemaker database. Previously, I used separate html pages to search the database when I needed different results pages to be returned, but this would allow a single search page.

So, all I need is the code to change the hidden tag
<INPUT TYPE=hidden NAME="-response" VALUE="MPCableResults.html">
to other values based upon the selected value of the <SELECT NAME=Catagory> popup value list.

If it can do that, then the lasso query will work correctly when submitted.

Here is the form portion of my page:

<FORM ACTION="action.lasso" METHOD=POST>
<P><TABLE BORDER=6 CELLSPACING=0 CELLPADDING=4>
<TR>
<TD COLSPAN=5>
<CENTER><TABLE BORDER=0 CELLSPACING=4 CELLPADDING=0 WIDTH=700 HEIGHT=96>
<TR>
<TD ROWSPAN=2 WIDTH=150 height=150>
<P><IMG SRC="Images/MotionProLogoFlanWeb.jpg" X-CLARIS-USEIMAGEWIDTH X-CLARIS-USEIMAGEHEIGHT ALIGN=bottom></P>
</TD>
<TD ROWSPAN=2 WIDTH=150>
<P ALIGN=right><FONT SIZE="+2" COLOR="#FFFFFF"><B>Motorcycle
</B></FONT></P>
</TD>
<TD ALIGN=center ROWSPAN=2 WIDTH=150
height=150>
<H6><FONT SIZE="+1" COLOR="#FFFFFF"><IMG SRC="Images/FlanLogoSmall.jpg" X-CLARIS-USEIMAGEWIDTH X-CLARIS-USEIMAGEHEIGHT ALIGN=bottom></FONT></H6>
</TD>
<TD ROWSPAN=2 WIDTH=150 height=150>
<P><FONT SIZE="+2" COLOR="#FFFFFF"><B>Accessories</B></FONT></P>
</TD>
<TD ROWSPAN=2 WIDTH=150>
<P ALIGN=right><IMG SRC="Images/MotionProLogoFlanWeb.jpg" X-CLARIS-USEIMAGEWIDTH X-CLARIS-USEIMAGEHEIGHT ALIGN=bottom></P>
</TD>
</TR>
<TR></TR>
</TABLE>
<BR>
<INPUT TYPE=hidden NAME="-database" VALUE="_Flan_Levers.fp5">
<INPUT TYPE=hidden NAME="-layout" VALUE=Cables2>
<INPUT TYPE=hidden NAME="-response" VALUE="MPCableResults.html"><INPUT TYPE=hidden NAME="-NoResultsError" VALUE="MPCableError.html">
<FONT SIZE="+3" COLOR="#FFFF00"><B>Flanders
Motion Pro Cable Search</B></FONT></CENTER>
</TD>
</TR>
<TR>
<TD VALIGN=bottom COLSPAN=5 HEIGHT=27 BGCOLOR="#FFFF00">
<P><FONT SIZE="+2" COLOR="#000000"><B>1. Choose
Cable Style:</B></FONT></P>
</TD>
</TR>
<TR>
<TD COLSPAN=2>
<P><B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SELECT NAME=Catagory>
<OPTION>Std Replacement Cable
<OPTION>T2 - Gray Cable
<OPTION>Custom Length Cable
<OPTION>Spcl Length Vinyl Cable
<OPTION>Throttle Cable
<OPTION>Throttle Sleeve Cable
<OPTION>Motocross Cable
<OPTION>Misc MX &amp; Off Road Cable
<OPTION>Spcl Perf Cable
<OPTION>ATV Vinyl Cable
<OPTION>Cable
<OPTION>Extra Length Vinyl &amp; Stainless Cable
<OPTION>Harley SS Cable
<OPTION>Stainless Cable
<OPTION>Armor Coat Cable
<OPTION>Cruiser Extra L Cable
</SELECT></B></P>
</TD>
<TD>
<CENTER><FONT SIZE="+1" COLOR="#FFFF00"><B>Flanders
Universal Cables<BR>
&amp; Wire Assemblies </B></FONT></CENTER>
</TD>
<TD>
<CENTER><FONT SIZE="+1" COLOR="#FFFF00"><B>Flanders
Vintage<BR>
BMW Cables</B></FONT></CENTER>
</TD>
<TD>
<CENTER><FONT SIZE="+1" COLOR="#FFFF00"><B>Flanders
Vintage<BR>
Triumph &amp; Vespa Cables</B></FONT></CENTER>
</TD>
</TR>
<TR BGCOLOR="#FFFF00">
<TD VALIGN=bottom COLSPAN=5 HEIGHT=31>
<P><FONT SIZE="+2" COLOR="#000000"><B>2.
Identify Your Motorcycle or ATV:</B></FONT></P>
</TD>
</TR>
<TR BGCOLOR="#FFFF00">
<TD WIDTH=130 HEIGHT=37>
<P><INPUT TYPE=hidden NAME="-Operator" VALUE=Contains><FONT SIZE="+1"><B>Make:</B></FONT>&nbsp;<SELECT NAME=Make>

<OPTION>Honda
<OPTION>Kawasaki
<OPTION>Suzuki
<OPTION>Yamaha
</SELECT></P>
</TD>
<TD HEIGHT=37>
<P><INPUT TYPE=hidden NAME="-Operator" VALUE=equals><FONT SIZE="+1"><B>cc:</B></FONT>&nbsp;</FONT><SELECT NAME=EngineSize>

<OPTION>175
<OPTION>250
<OPTION>750
<OPTION>1000
</SELECT></P>
</TD>
<TD COLSPAN=3 HEIGHT=37>
<P><INPUT TYPE=hidden NAME="-Operator" VALUE=Contains><FONT SIZE="+1"><B>Year:</B></FONT>&nbsp;</FONT><SELECT NAME=AllYears>

<OPTION>2003
<OPTION>2002
<OPTION>2001
<OPTION>2000
<OPTION>1999
<OPTION>1998
<OPTION>1997
</SELECT><INPUT TYPE=hidden NAME=Catagory VALUE=Cable></P>
</TD>
</TR>
<TR>
<TD COLSPAN=5 HEIGHT=42>
<P><FONT SIZE="+2" COLOR="#000000"><B>3. Click
Choice:</B></FONT><FONT SIZE="+1" COLOR="#FFFFFF"><B>
</B></FONT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<INPUT TYPE=submit NAME="-Search" VALUE="Start Search"><INPUT TYPE=reset VALUE="Clear Form"></P>
</TD>
</TR>
</TABLE>
</FORM>


This may be more than you need, but hopefully it will help you fully understand the goal.
Please let me know if you need more info!

Thank you so much!
Ken

Jona
03-25-2003, 07:46 PM
Isn't that what I said? Changing the value of the hidden field that tells the database which page to look in. Hold on a minute, and I'll fix up something for ya.

Jona
03-25-2003, 07:58 PM
<html><head>
<script>
function chk(){
box = document.forms[0].Catagory[document.forms[0].Catagory.options.selectedIndex].value;
if(box=="StdReplacementCable"){
document.forms[0].response.value="thePage.html"
}
else if(box=="nextvalue"){
document.forms[0].response.value="thenextpage.html"
}
else{ //final result
document.forms[0].response.value="thelastpage.html"
}
}
</script>
</head><body>
<FORM ACTION="action.lasso" METHOD=POST>
<P><TABLE BORDER=6 CELLSPACING=0 CELLPADDING=4>
<TR>
<TD COLSPAN=5>
<CENTER><TABLE BORDER=0 CELLSPACING=4 CELLPADDING=0 WIDTH=700 HEIGHT=96>
<TR>
<TD ROWSPAN=2 WIDTH=150 height=150>
<P><IMG SRC="Images/MotionProLogoFlanWeb.jpg" X-CLARIS-USEIMAGEWIDTH X-CLARIS-USEIMAGEHEIGHT ALIGN=bottom></P>
</TD>
<TD ROWSPAN=2 WIDTH=150>
<P ALIGN=right><FONT SIZE="+2" COLOR="#FFFFFF"><B>Motorcycle
</B></FONT></P>
</TD>
<TD ALIGN=center ROWSPAN=2 WIDTH=150
height=150>
<H6><FONT SIZE="+1" COLOR="#FFFFFF"><IMG SRC="Images/FlanLogoSmall.jpg" X-CLARIS-USEIMAGEWIDTH X-CLARIS-USEIMAGEHEIGHT ALIGN=bottom></FONT></H6>
</TD>
<TD ROWSPAN=2 WIDTH=150 height=150>
<P><FONT SIZE="+2" COLOR="#FFFFFF"><B>Accessories</B></FONT></P>
</TD>
<TD ROWSPAN=2 WIDTH=150>
<P ALIGN=right><IMG SRC="Images/MotionProLogoFlanWeb.jpg" X-CLARIS-USEIMAGEWIDTH X-CLARIS-USEIMAGEHEIGHT ALIGN=bottom></P>
</TD>
</TR>
<TR></TR>
</TABLE>
<BR>
<INPUT TYPE=hidden NAME="-database" VALUE="_Flan_Levers.fp5">
<INPUT TYPE=hidden NAME="-layout" VALUE=Cables2>
<INPUT TYPE=hidden NAME="response" VALUE="MPCableResults.html"><INPUT TYPE=hidden NAME="-NoResultsError" VALUE="MPCableError.html">
<FONT SIZE="+3" COLOR="#FFFF00"><B>Flanders
Motion Pro Cable Search</B></FONT></CENTER>
</TD>
</TR>
<TR>
<TD VALIGN=bottom COLSPAN=5 HEIGHT=27 BGCOLOR="#FFFF00">
<P><FONT SIZE="+2" COLOR="#000000"><B>1. Choose
Cable Style:</B></FONT></P>
</TD>
</TR>
<TR>
<TD COLSPAN=2>
<P><B> <SELECT NAME=Catagory onChange="chk()">
<OPTION value="StdReplacementCable">Std Replacement Cable
<OPTION value="T2GrayCable>T2 - Gray Cable
<OPTION value="CustomLenghtCable">Custom Length Cable
<OPTION value="SpclLengthVinylCable">Spcl Length Vinyl Cable
<OPTION>Throttle Cable
<OPTION>Throttle Sleeve Cable
<OPTION>Motocross Cable
<OPTION>Misc MX & Off Road Cable
<OPTION>Spcl Perf Cable
<OPTION>ATV Vinyl Cable
<OPTION>Cable
<OPTION>Extra Length Vinyl & Stainless Cable
<OPTION>Harley SS Cable
<OPTION>Stainless Cable
<OPTION>Armor Coat Cable
<OPTION>Cruiser Extra L Cable
</SELECT></B></P>
</TD>
<TD>
<CENTER><FONT SIZE="+1" COLOR="#FFFF00"><B>Flanders
Universal Cables<BR>
& Wire Assemblies </B></FONT></CENTER>
</TD>
<TD>
<CENTER><FONT SIZE="+1" COLOR="#FFFF00"><B>Flanders
Vintage<BR>
BMW Cables</B></FONT></CENTER>
</TD>
<TD>
<CENTER><FONT SIZE="+1" COLOR="#FFFF00"><B>Flanders
Vintage<BR>
Triumph & Vespa Cables</B></FONT></CENTER>
</TD>
</TR>
<TR BGCOLOR="#FFFF00">
<TD VALIGN=bottom COLSPAN=5 HEIGHT=31>
<P><FONT SIZE="+2" COLOR="#000000"><B>2.
Identify Your Motorcycle or ATV:</B></FONT></P>
</TD>
</TR>
<TR BGCOLOR="#FFFF00">
<TD WIDTH=130 HEIGHT=37>
<P><INPUT TYPE=hidden NAME="-Operator" VALUE=Contains><FONT SIZE="+1"><B>Make:</B></FONT> <SELECT NAME=Make>

<OPTION>Honda
<OPTION>Kawasaki
<OPTION>Suzuki
<OPTION>Yamaha
</SELECT></P>
</TD>
<TD HEIGHT=37>
<P><INPUT TYPE=hidden NAME="-Operator" VALUE=equals><FONT SIZE="+1"><B>cc:</B></FONT> </FONT><SELECT NAME=EngineSize>

<OPTION>175
<OPTION>250
<OPTION>750
<OPTION>1000
</SELECT></P>
</TD>
<TD COLSPAN=3 HEIGHT=37>
<P><INPUT TYPE=hidden NAME="-Operator" VALUE=Contains><FONT SIZE="+1"><B>Year:</B></FONT> </FONT><SELECT NAME=AllYears>

<OPTION>2003
<OPTION>2002
<OPTION>2001
<OPTION>2000
<OPTION>1999
<OPTION>1998
<OPTION>1997
</SELECT><INPUT TYPE=hidden NAME=Catagory VALUE=Cable></P>
</TD>
</TR>
<TR>
<TD COLSPAN=5 HEIGHT=42>
<P><FONT SIZE="+2" COLOR="#000000"><B>3. Click
Choice:</B></FONT><FONT SIZE="+1" COLOR="#FFFFFF"><B>
</B></FONT>
<INPUT TYPE=submit NAME="-Search" VALUE="Start Search"><INPUT TYPE=reset VALUE="Clear Form"></P>
</TD>
</TR>
</TABLE>
</FORM> </body>

SoCalMacDude
03-26-2003, 06:57 PM
WOW!! Thanks Jona!!

That looks like the perfect answer!!

I am building out the database a bit before I can fully test it, but it makes sense to me!

Thank you, Thank you, Thank you, Thank you, Thank you, Thank you, Thank you, Thank you, Thank you, Thank you, Thank you, Thank you, Thank you, Thank you, Thank you!

Ken

SoCalMacDude
04-02-2003, 05:52 PM
Well, now that I have built out the database enough to actually test this script, I find that it doesn't pass the "-Response" value to lasso, which was the original goal!

I have made 2 search pages, one with the response page hard coded, and one that depends on the Javascript to set the value.

Hard Coded:
http://www.flandersco.com/mpcablesearch1.html

JavaScript version:
http://www.flandersco.com/mpcablesearch.html

If you use the default motorcycle, there are no records in the database, and you get the Lasso diagnostic error page (I pulled my error page), so you can see the Response page that Lasso plans to send back to the browser.

If you want to see actual results, search for Honda 250 1995.

The goal is to be able to pop up a cable style of T2-Gray Cable, and have it choose the T2GrayResults.html response page.

Any help with debugging this would be greatly appreciated!
Thanks,
Ken

P.S. I probably made a bonehead move in the implementation of Jona's beautiful script! ;-)