473,396 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Form Script Help

Sev
Website: www.flywessex.blogspot.com

You can see from the page source what an effin' mess I'm making of the
site. Aside from all the obvious alignment issues, I can't get the code
to link to the web pages within the pop up boxes. They did a minute
ago, and now I've been editing the template, they don't.

Sorry if I have not supplied enough information - but I know nothing.
Anything I've done has been from searching google and copying code.

Please help.
Jul 23 '05 #1
2 1303
Sev wrote:
Website: www.flywessex.blogspot.com

You can see from the page source what an effin' mess I'm making of the
site. Aside from all the obvious alignment issues, I can't get the code
to link to the web pages within the pop up boxes. They did a minute
ago, and now I've been editing the template, they don't.

Sorry if I have not supplied enough information - but I know nothing.
Anything I've done has been from searching google and copying code.

Please help.


Hi Sev,

:) Fortunately your problem is very easy to fix.

Below is a snippet of javascript and html from your site:

<form name = "INTERVIEWS">
<select name="site" size=1>
<option value="">Click to select</option>
<option value="http://some page.html">text
</select><br><br>
<input type=button value="Go!" onClick="javascript:formHandler(this)">
</form>

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function formHandler(form){
var URL =
document.form.site.options[document.form.site.selectedIndex].value;
window.location.href = URL;
}
// End -->
</SCRIPT>

Sev, here is a more "correct" way of doing it. For your forms write
them out like so:

<form name = "abc" onSubmit = "return formHandler(this)">
<select name = "site" size = "1">
<option value = "http://value1">text 1</option>
<option value = "http://value2">text 2</option>
</select>
<input type = "submit" value = "Go!">
</form>

For your javascript portion, it would be better if you moved it into
the <head></head> section of your html, and rewritten like so:

<script language = "javascript" type = "text/javascript">
<!--
function formHandler(myForm)
{
var URL = myForm.site.options[myForm.site.selectedIndex].value;
window.location.href = URL;

return false;
}
//-->
</script>

The problem with your current script is you have your input button call
formHandler with "this". But "this" is really a reference to the input
button, and not the form that you were hoping for. Hope this helps. :)

Jul 23 '05 #2
Sev
web.dev wrote:
Sev wrote:
Website: www.flywessex.blogspot.com

You can see from the page source what an effin' mess I'm making of the
site. Aside from all the obvious alignment issues, I can't get the code
to link to the web pages within the pop up boxes. They did a minute
ago, and now I've been editing the template, they don't.

Sorry if I have not supplied enough information - but I know nothing.
Anything I've done has been from searching google and copying code.

Please help.

Hi Sev,

:) Fortunately your problem is very easy to fix.

Below is a snippet of javascript and html from your site:

<form name = "INTERVIEWS">
<select name="site" size=1>
<option value="">Click to select</option>
<option value="http://some page.html">text
</select><br><br>
<input type=button value="Go!" onClick="javascript:formHandler(this)">
</form>

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function formHandler(form){
var URL =
document.form.site.options[document.form.site.selectedIndex].value;
window.location.href = URL;
}
// End -->
</SCRIPT>

Sev, here is a more "correct" way of doing it. For your forms write
them out like so:

<form name = "abc" onSubmit = "return formHandler(this)">
<select name = "site" size = "1">
<option value = "http://value1">text 1</option>
<option value = "http://value2">text 2</option>
</select>
<input type = "submit" value = "Go!">
</form>

For your javascript portion, it would be better if you moved it into
the <head></head> section of your html, and rewritten like so:

<script language = "javascript" type = "text/javascript">
<!--
function formHandler(myForm)
{
var URL = myForm.site.options[myForm.site.selectedIndex].value;
window.location.href = URL;

return false;
}
//-->
</script>

The problem with your current script is you have your input button call
formHandler with "this". But "this" is really a reference to the input
button, and not the form that you were hoping for. Hope this helps. :)


I've no idea what it all means but it works! Thanks a million, Web.dev.
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: James | last post by:
My form and results are on one page. If I use : if ($Company) { $query = "Select Company, Contact From tblworking Where ID = $Company Order By Company ASC"; }
7
by: Randell D. | last post by:
Folks, I am working on a contact db using PHP and MySQL. My results so far outputs a slimed down version of records to the browser. I would like to implement a method whereby the user can...
1
by: Randell D. | last post by:
HELP! I am determined to stick with this... I'm getting there... for those who haven't read my earlier posts, I'm createing what should be a simple function that I can call to check that...
2
by: Mark Hannon | last post by:
I am trying to wrap my brain around storing form elements inside variables & arrays before I move on to a more complicated project. I created this simple example to experiment and as far as I can...
7
by: Steve Wylie | last post by:
Last year a kind soul by the name of Lasse Reichstein Nielsen answered a question for me on this newsgroup, including a script that solved my problem. I now need to script to be slightly amended to...
10
by: Kathy Burke | last post by:
HI. in asp.net app, I have an xmlDocument that I transform to the client html. Using xsl I create a few textboxes to capture user input. Each of these are related to <data> elements in the xmlDoc....
5
by: Navillus | last post by:
Hey gang, I have a login form that is empty by default, but can be filled with values from a previous form: <input type=text maxlength="40" size="40" name="user" value="`usr`"> <input...
4
by: Cerebral Believer | last post by:
Hi I need help! Forgive me I am a PHP newbie. I have a small script that enables me to send a form from an HTML page. I want to use the HTML formatted form because the design of my website is...
5
by: plumba | last post by:
Hi all I have a form (see below), which for some reason has decided to stop functioning all together. It just does not call up the function. It is called up in the opening <form> tag but...
0
bmallett
by: bmallett | last post by:
First off, i would like to thank everyone for any and all help with this. That being said, I am having a problem retrieving/posting my dynamic form data. I have a form that has multiple options...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.