Click to See Complete Forum and Search --> : using target attribute in a form script?
rsaund
01-30-2003, 09:52 AM
I am trying to use this form script in a site that uses frames. I cannot get the “target” to work – the link opens in the window that contains the script, not the window I am attempting to target. Is there a way to make this work? Or does this particular script not work with the “target” attribute? I am a neophyte, please be kind:) and THANKS in advance!!
Robin
<form name="jump">
<select name="menu" onChange="location=document.jump.menu.options[document.jump.menu.selectedIndex].value;" value="GO">
<option value="#">Select a Product</option>
<option value="traction_sub/3dat.html" target="body">3D ActiveTrac</option>
<option value="traction_sub/cht.html" target="body">Cervical Hometrac</option>
<option value="traction_sub/lht.html" target="body">Lumbar Hometrac</option>
<option value="ex_sub/total_back.html" target="body">Total Back Exercise</option>
<option value="bs_sub/sport_all.html" target="body">S'port All Back Support</option>
<option value="bs_sub/support_line.html" target="body">All Other Back Supports </option>
<option value="educ_sub/manuals.html" target="body">Educational Manuals</option>
<option value="educ_sub/videos.html" target="body">Educational Videos</option>
</select>
</form>
Charles
01-30-2003, 10:37 AM
How are people without JavaScript going to navigate with that? Try:
<form name="jump" action="menu.pl">
<div>
<select name="menu">
<option value="#">Select a Product</option>
<option value="traction_sub/3dat.html">ActiveTrac</option>
<option value="traction_sub/cht.html"> Cervical Hometrac</option>
<option value="traction_sub/lht.html">Lumbar Hometrac</option>
<option value="ex_sub/total_back.html">Total Back Exercise</option>
<option value="bs_sub/sport_all.html">S'port All Back Support</option>
<option value="bs_sub/support_line.html" >All Other Back Supports </option>
<option value="educ_sub/manuals.html">Educational Manuals</option>
<option value="educ_sub/videos.html">Educational Videos</option>
</select>
<input type="submit">
</div>
</form>
And then get something like the following up and running and named something like "menu.pl":
#!usr/local/bin/perl
use CGI qw(redirect param);
print redirect param('menu');
rsaund
01-30-2003, 12:47 PM
thank you! I have NO cgi/perl experience, but I did manage to create a script called menu.pl, and call it from my webpage, enough to verify that I am hitting the script.
However, the script is incomplete, cause I'm not sure how to fill in the gaps. Are you willing to complete the first couple of lines for me to get me started? In other words, can you tell me explicitly where I put the url for the webpage and where I put the frame target? In my case, the target is 'body'. To keep it simple, you can use "url1" "url2" etc... I would really appreciate it!
To review, I need the url to open in a particular frame (target='body'), not in the same frame that the form script is in. THANKS!!!
Robin
Charles
01-30-2003, 03:50 PM
Please forgive me. My haste got the better of me and there are a few errors on that last post opf mine.
The FORM tag should look like:
<form name="jump" action="menu.pl" target="body">
The first line of the PERL script tells the server where to find the PERL interpreter and is specific to each server. You will also need to know what directory your script will need to go in so have a little chat with your server people.
You will have to upload the file as ASCII and you will have to set the file permissions so that the script will run.
You can either use the script as it is and use a full URL with each OPTION value or use something like:
#!usr/local/bin/perl
use CGI qw(redirect param);
print redirect 'http://www.myHappyWebSite.com/'.param('menu');
rsaund
01-30-2003, 03:54 PM
thanks charles, I will try that right away. I have been reading cgi tutorials in the meantime, so what you're saying makes sense.
Robin
rsaund
01-30-2003, 04:12 PM
Got it to work! THANKS VERY MUCH it is perfect, except it is a little slow loading the page to the window, not sure why. It's slower than a direct hyperlink, so I guess that's due to running the script... But I think it's going to be ok - beggars can't be choosers, right!? THANKS again for your help!
Robin