473,803 Members | 3,518 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

define the submit button

Hello, I'd like to pass the "levelbtn" value when I click the filter
button, but there are also other submit form buttons.

I defined as "document.testf orm.submit();" in the javascript, but I
don't think it is right.

-----------------------------------------------

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled </title>
</head>

<body>
<script language="JavaS cript">
<!--
function submitForm(){
if (document.testf orm.leveltype.v alue != "" &&
document.testfo rm.officename.v alue != "") {
document.testfo rm.submit();
}
else {
alert("Please select level and/or office before pressing the
button");
}
}
//-->
</script>

<form name="testform" method="post" action="test02. cfm">

<input type="text" name="leveltype " value="" />

<input type="text" name="officenam e" value="" />

<input type="Button" name="levelbtn" value="Filter"
onclick="submit Form()" />

<input type="submit" name="innerbtn" value="inner" />

<input type="submit" name="outerbtn" value="outer" />

</form>
</body>
</html>
Jul 23 '05 #1
1 2068
reneecccwest wrote:
Hello, I'd like to pass the "levelbtn" value when I click the filter
button, but there are also other submit form buttons.

I defined as "document.testf orm.submit();" in the javascript, but I
don't think it is right.
Correct. Submit will be impossible without JavaScript then, aside from
the fact that you never know what is considered the default submit button.
[...]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
There is the URL of the DTD (the system identifier) missing before
it is Valid HTML. The W3C Markup Validator is misguiding here as
it uses an Open Catalog for mapping DOCTYPE declarations to files.
(See comp.infosystem .www.authoring.misc)
<html>
<head>
<title>Untitled </title>
I hope this is different in the real document.
</head>

<body>
<script language="JavaS cript">
This should read

<script type="text/javascript">
<!--
function submitForm(){
function submitForm(o)
{
var result = false;
if (document.testf orm.leveltype.v alue != "" &&
document.testfo rm.officename.v alue != "") {
document.testfo rm.submit();
}
else {
alert("Please select level and/or office before pressing the
button");
}
var e = o && o.elements;
if (e)
{
if (e['leveltype'].value != ""
&& e['officename'].value != "")
{
result = true;
}
else
{
alert(
"Please select level and/or office before pressing the button");
}
}

return result;
} //-->
</script>
You better place the script in the "head" element.
<form name="testform" method="post" action="test02. cfm">
<form
action="test02. cfm"
method="post"
onsubmit="retur n submitForm(this )">
<input type="text" name="leveltype " value="" />

<input type="text" name="officenam e" value="" />

<input type="Button" name="levelbtn" value="Filter"
onclick="submit Form()" />

<input type="submit" name="innerbtn" value="inner" />

<input type="submit" name="outerbtn" value="outer" />
This is not XHTML, and there are default values for
some attributes, so you can safely omit them.

<input name="leveltype ">
<input name="officenam e">
<input type="submit" name="levelbtn" value="Filter">
<input type="submit" name="innerbtn" value="inner">
<input type="submit" name="outerbtn" value="outer">
</form>
[...]

HTH

PointedEars
Jul 23 '05 #2

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

Similar topics

3
2909
by: Matt | last post by:
I want to understand the difference between submit button and regular button: <input type="submit"> and <input type="button">. My understanding is that submit button will send the entire HTML form to the web server, but regular button won't. I have a problem that needs to pass HTML elements data back and forth in several ASP pages. I am using regular button to do that. But what's the approaches?? Please advise. Thanks!
2
41059
by: jb | last post by:
Hello, I need to know which button was pressed in the submit , i tried reading the vaule of submit it the validateDate function but it returns 'undefined' value ; I do this in asp all the time, Not sure how to do it in javascript <form name="form1" method="post" action="myNewplace.asp" ONSUBMIT="return ValidateData();"> <input type="Submit" name="Submit" value="Save" >
15
28962
by: Mattia | last post by:
Hi! I have a <form> that can be submitted thruogh three buttons and I need to tell witch one was pressed when the form was submitted. I now do it with 3 <input type="submit" name="..." value="..."> with <input type="submit" ...> the only name-value values submitted (pushed into the query string) is the one of the submit button that was pushed (if you have many of them). Ex:
15
6583
by: M Smith | last post by:
I have a form I want to submit to itself. I want to be able to type in a list of numbers and submit the form and have that list show up on the same form under the text box I typed them into and the buttons. The problem is when I post a form to itself, the Enter key will not submit the form, it only clears the contents of the text box. The only way I can submit is to click the submit button. Here is a simplified version of my code that I...
3
10155
by: Adam | last post by:
Hey guys, I've decided to stop banging my head against the wall and just ask you guys for the answer. I can't seem to find it. I have a form in which I have multiple submit buttons; only, I'm using button tags, not input tags to do it. It seems that IE6 is treating all the button elements as being successful on submit. This is, to say the least, surprising since the Spec is pretty clear that it should.
5
8452
by: rjames.clarke | last post by:
I have the following. $result=mysql_query($sql); $nrows=mysql_num_rows($result); for ($i=0;$i<$nrows;$i++) { $row_array=mysql_fetch_row($result); echo "<form name='testform' action='ins_op.php' method='post'>"; lots of form stuff
4
5592
by: Dmitry Korolyov [MVP] | last post by:
When we use btnSubmit.Attributes = "javascript: this.disabled=true;" to make the button disabled and prevent users from clicking it again while form data still posting, there is no longer postback. I.e. the button does go disabled, but the form does not invoke submit() method. Of course, it does work fine without this property. Clues?
3
3172
by: Jeff | last post by:
I have a payment form with a submit button. A large percentage of users double-click the submit button thus submitting their payment information twice. I would like to use javascript to disable the submit button once it's been clicked, yet still have the form submit. I can do this in ASP 2.0, however, ASP.Net seems to be adversely affected if you disable the submit button. Here's how I have it set up... The submit button is a...
4
5515
by: j1dopeman | last post by:
Hi, I'd like to use a button to save and then submit a form. I can set the onlick of the button to mahButton_click or submit, but I can't figure out how to do both. It looks like c# can't call a form's submit. I've found how to post programatically, but I need to use the form's target attribute so that the response goes into another frame, and I can't figure out how to do that programatically.
0
9699
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
9562
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10309
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...
1
10289
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10068
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9119
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...
1
7600
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6840
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();...
1
4274
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

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.