473,624 Members | 2,245 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

dynamic form needs to be static

Hi,
I am working on a project where I have to make a form list static,
i.e. put in links so that users can choose a local file. As it stands,
it's looking for a php file. Here's an example of the body code:

<select name="standardc ode" size="10"
onchange="docum ent.reqForm.sub mit()" tabindex="4">
<option value="0" SELECTED>-- Select a
Standard--</option>
<option value= >Alabama</option>

And here's the code in the head:

function doSubmit( fm, bn ) {
document[fm].button.value = bn;
document[fm].submit();
}

How do I rewrite this form code so that a user can scroll down the
menu, select a state, and have it link to another page on the site?

Any help is MUCH appreciated!!
Jul 23 '05 #1
3 1800
In article <b6************ **************@ posting.google. com>, chez4
@pacbell.net enlightened us with...

<select name="standardc ode" size="10"
onchange="docum ent.reqForm.sub mit()" tabindex="4">
<option value="0" SELECTED>-- Select a
Standard--</option>
<option value= >Alabama</option>
So, the form submits when a user selects a state.
(note that the code you showed in the head does not fire here)

How do I rewrite this form code so that a user can scroll down the
menu, select a state, and have it link to another page on the site?


Just change the action in the form tag to the proper page. Myself, I'd
change it to a php page and have that page do the work depending on
state. Since a form was submitted, the value of that select would be
available.

But, if you wanted that page to vary depending on the state and just
want to use script, you'd need further adjustments.

<select name="standardc ode" size="10"
onchange="go(th is.options[selectedIndex].value)" tabindex="4">
<option value="0" SELECTED>-- Select a State--</option>
<option value='AL'>Alab ama</option>

function go(val)
{
// val is the state like AL
if (val == '0')
{
alert ("You must choose a state.");
return;
}

if (val == 'AL') window.location =
'http://www.server.com/somePage.php';
else if (val == 'IL' ) window.location =
'http://www.server.com/someotherPage.p hp' ;
// etc
}

HTH
--
--
~kaeli~
If you don't pay your exorcist, you get repossessed.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #2
Nancy, copy/paste the code below.

Orlando, aka, Cycloneous

<HTML>
<HEAD>

<TITLE>JavaScri pt</TITLE>
<script language = "javascript " type="text/javascript">

function doSubmit() {

var i = document.regFor m.standardcode. selectedIndex;
var url = document.regFor m.standardcode. options[i].value;

// first option
// comment to unactivate

document.regFor m.action = url;
document.regFor m.submit();

// second option
// uncomment to activate

// location.href = url;

}

</script>
</HEAD>

<BODY>
<form name = "regForm">
<select name="standardc ode" size="10" onChange="doSub mit();" tabindex="4">
<option value="0" SELECTED>-- Select a Standard--</option>
<option value="http://www.reuters.com/">Reuters News</option>
<option value="http://www.engr.uconn. edu/">UConn</option>
<option value="http://home.netscape.c om/">Netscape</option>
<option value="http://www.cnn.com/">CNN</option>
</select>

</BODY>
</HTML>
Jul 23 '05 #3
Hi Cycloneous Echevarria,

Thanks for your help. I tried your suggestion, but I still can't get my
page to work. (I don't know javascript!). Here is all the script in the
head.
I pasted your script in at the bottom.
<SCRIPT language="JavaS cript" TYPE="text/javascript">
<!--

var NSWindows;
var is = new Object();
is.agent = navigator.userA gent.toLowerCas e();
is.ie55 = (is.agent.index Of("msie 5.5") != -1);
is.ie6 = (is.agent.index Of("msie 6") != -1);
is.ns6x = (is.agent.index Of("netscape6" ) != -1);
is.moz = (is.agent.index Of("gecko")!= -1);
is.win = (is.agent.index Of("win") != -1);
function NSWindowOpen(pa th, winName, dimensions, scrollbars,
toolbar, properties, loc_left, loc_top) {
if (NSWindows == null) {
NSWindows = new Array();
}
var index = NSWindows.lengt h;
for (var i = 0; i < NSWindows.lengt h; i ++) {
if (NSWindows[i] == null) {
index = i;
break;
}
if (winName == null) {
if (NSWindows[i].closed) {
index = i;
break;
}
} else {
if (NSWindows[i].closed) {
index = i;
} else if (NSWindows[i].name == winName) {
NSWindows[i].close();
index = i;
break;
}
}
}
if (winName == null) {
winName = "nswin" + index;
}
if (dimensions == null) {
dimensions = "width=780,heig ht=540";
}
if (properties == null) {
properties = "resizable=yes" ;
if ((scrollbars == null) || (scrollbars == true)) {
properties += ",scrollbars=ye s";
}
if (toolbar == true) {
properties += ",toolbar=y es";
}
} else {
if (properties.ind exOf("resizable =") == -1) {
properties += ",resizable=yes ";
}
if ((properties.in dexOf("scrollba rs=") == -1) &&
((scrollbars == null) || (scrollbars == true))) {
properties += ",scrollbars=ye s";
}
if ((properties.in dexOf("toolbar= ") == -1) &&
(toolbar == true)) {
properties += ",toolbar=y es";
}
}
if (loc_left && loc_top) {
properties += ",top=" + loc_top + ",left=" + loc_left;
} else if (loc_left) {
var loc_x = Math.floor((scr een.availLeft || 0) + (loc_left / 100 *
screen.availWid th));
var loc_y = Math.floor((scr een.availTop || 0) + (loc_left / 100 *
screen.availHei ght));
properties += ",top=" + loc_y + ",left=" + loc_x;
}
var offsite = false;
if( (path.indexOf(' http') != -1 && path.indexOf('n etschools') == -1)
||
path.indexOf('o ffsite') != -1 ) {
offsite = true;
}
properties += "," + dimensions;
NSWindows[index] = window.open(pat h, winName, properties);
return false;
}
function NSWindowOpenNoF alse(path, winName, dimensions, scrollbars,
toolbar, properties, loc_left, loc_top) {
NSWindowOpen(pa th, winName, dimensions, scrollbars, toolbar,
properties, loc_left, loc_top);
}
function NS_openWindow(p age) {
NSWindowOpen(pa ge, 'NSWindow', null, null, null,
'menubar=yes');
}

function NS_swapImageSim ple( image, pos ) {
document.images[pos].src = image;
}

function MM_openBrWindow (theURL,winName ,features) { //
v2.0
if (objWindow && !objWindow.clos ed){
objWindow.close ();
}
objWindow = window.open(the URL,winName,fea tures);
objWindow.focus ();
}
function NSbutton_preloa dImages() { //v3.0
var d=document; if(d.images){ if(!d.NSbutton_ p)
d.NSbutton_p=ne w Array();
var
i,j=d.NSbutton_ p.length,a=NSbu tton_preloadIma ges.arguments; for(i=0;
i<a.length; i++)
if (a[i].indexOf("#")!= 0){ d.NSbutton_p[j]=new Image;
d.NSbutton_p[j++].src=a[i];}}
}

function doSubmit() {

****var i = document.regFor m.standardcode. selectedIndex;
****var url = document.regFor m.standardcode. options[i].value;
****
****document.re gForm.action = url;
****document.re gForm.submit();

****// second option
****// uncomment to activate
****
****// location.href = url;
****
}

//-->
</SCRIPT>
And here's what's in the body.

<TD CLASS="form-item-label">&nbsp;</TD>
<TD>&nbsp;</TD>
<TD CLASS="form-item"><TABLE BORDER="0" CELLPADDING="0"
CELLSPACING="0" >
<TR>
<TD CLASS="form-item"> Standard</TD>
</TR>
<TR>
<TD>
<form name = "regForm"><sele ct name="standardc ode" size="10"
onChange="doSub mit();" tabindex="4">
****<option value="0" selected>-- Select a standard--</option>
<option value="../Teacher/MySchool/Reports/SampleReports/AL/AL
curr cov.htm">Alabam a</option>

Can anyone see my problem here?
When I select the state, the htm file will not load.
thanks!
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #4

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

Similar topics

4
2135
by: pizzy | last post by:
INTRO: I tried to clean it up for easy reading. I hope I didn't make any mistakes. PROBLEM: WOW, this is some crazy sh!t. I can't get my checkbox (see "TAGSELECTED") to print my textboxes (see "TAG#") when more than 1 number (see "VLANS") is inputed into my form. QUESTION: How do I make my dynamic form have a dynamic input box(which is created by checking the checkbox and calling the functionC1) inside it and still be able to pass the...
0
1971
by: Pat Patterson | last post by:
I'm having serious issues with a page I'm developing. I just need some simple help, and was hoping someone might be able to help me out in here. I have a form, that consists of 3 pages of fields. I'd like to create a page in which all of this is stored as you move along as hidden variables, until the end, when the user submits. I can't figure out one thing: I have dynamic form elements (dropdowns), that I'd like to use instead of...
3
2936
by: CAD Fiend | last post by:
Hello, Well, after an initial review of my database by my client, they have completely changed their minds about how they want their form. As a result, I'm having to re-think the whole process. My Current Form (6 tabs): - Owner, Property, Title, Docs, Queries, & Reports - User is able to see (while navigating through the tabs) above in the form : Owner Name, Address, Parcel, and SSN
4
3301
by: Venus | last post by:
Hello, Thanks for your reply. I understand that a control can be created dynamically in several ways: 1) using StringBuilder 2) using Controls.Add 3) using ASP PlaceHolder But this is just for the controls and not for the form itself. What I am trying to achieve is to create an entire form (including controls)
13
14606
by: Krivenok Dmitry | last post by:
Hello all! Perhaps the most important feature of dynamic polymorphism is ability to handle heterogeneous collections of objects. ("C++ Templates: The Complete Guide" by David Vandevoorde and Nicolai M. Josuttis. Chapter 14.) How to implement analogue of this technique via static polymorphism? Perhaps there is special design pattern for this purpose...
6
6531
by: kode4u | last post by:
How to use python get my windows box's ip setting type? Dynamic ip, or static ip? If it's static ip, what's the exact value?
2
9666
by: 09876 | last post by:
Hi: all I understand the difference between dynamic binding and static binding. But I just wonder what is the point to make the distinction between the dynamic binding and static binding. For example, in c, if a function pointer is used. say something like that float (*pt2Func)(float, float); so the compiler doesn't know what is pt2Func to be called until at run-time. Is it dynamic binding? Thanks.
0
3376
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 within options. I have everything being dynamically named from the previously dynamically named element. (I hope this makes sense.) I am not able to retrieve any of the dynamically created values. I can view them on the source page but can't pull them...
0
8233
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8675
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8619
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7158
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5561
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4078
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4173
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2604
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1784
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.