473,659 Members | 2,662 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

javasript problem - submiting

Please look at my code.
I do validation of my form before I submit it.

I want to be able to to press one form button without running validating
script.
I just want to go directly to my php script.

I tried to do this
onclick="docume nt.form1.submit ()" but than the button value is not posted
and my php script is not working.

Also I tried to remove the onSubmit handler on my form and than I add this
to all my 3 buttons that will run with validation.
<input type="button" name="select" value="save" on click="return
check(this);doc ument.form1.sub mit()"It is not working I get error that Java
does not support that object or method.Also the value save is not
submitted.Is there any way to fix this
Jul 20 '05 #1
8 2796
> Please look at my code.
I do validation of my form before I submit it.
Do this instead:

<form onsubmit="retur n checkForm()" ...>

Have checkForm return true if all is good and return false if there is
an error.

This will let you use a normal submit button and will let the form
work if javascript is disabled.

Jeff

I want to be able to to press one form button without running validating
script.
I just want to go directly to my php script.

I tried to do this
onclick="docume nt.form1.submit ()" but than the button value is not posted
and my php script is not working.

Also I tried to remove the onSubmit handler on my form and than I add this
to all my 3 buttons that will run with validation.

<input type="button" name="select" value="save" on click="return
check(this);doc ument.form1.sub mit()"It is not working I get error that Java
does not support that object or method.Also the value save is not
submitted.Is there any way to fix this

Jul 20 '05 #2


Jeff Thies wrote:
Please look at my code.
I do validation of my form before I submit it.
Do this instead:

<form onsubmit="retur n checkForm()" ...>


I've reread your post and I think I misunderstood what you wanted. I
think you want a submit button that bypasses the onsubmit validation

Try this

<form onsubmit="retur n checkForm()" ...>
<input type="submit" value="normal" >
<input type="submit" value="bypass" onclick="bypass ='1'">
var bypass;
function checkForm(){
if(bypass){retu rn true;}
....
normal form check code ...

Jeff


Have checkForm return true if all is good and return false if there is
an error.

This will let you use a normal submit button and will let the form
work if javascript is disabled.

Jeff

I want to be able to to press one form button without running validating
script.
I just want to go directly to my php script.

I tried to do this
onclick="docume nt.form1.submit ()" but than the button value is not posted
and my php script is not working.

Also I tried to remove the onSubmit handler on my form and than I add this
to all my 3 buttons that will run with validation.

<input type="button" name="select" value="save" on click="return
check(this);doc ument.form1.sub mit()"It is not working I get error that Java
does not support that object or method.Also the value save is not
submitted.Is there any way to fix this

Jul 20 '05 #3
I like the idea,but I am having problems with passing the bypass value to
the script.

I have onclick="bypass ='1'"
and in my script I have

var bypass
if (bypass) {return true;}

my function...

shoutnot it be
if (bypass==1) {return true;}

Because this is not working.

Bart,


















"Jeff Thies" <cy*******@spri ntmail.com> wrote in message
news:3F******** *******@sprintm ail.com...


Jeff Thies wrote:
Please look at my code.
I do validation of my form before I submit it.


Do this instead:

<form onsubmit="retur n checkForm()" ...>


I've reread your post and I think I misunderstood what you wanted. I
think you want a submit button that bypasses the onsubmit validation

Try this

<form onsubmit="retur n checkForm()" ...>
<input type="submit" value="normal" >
<input type="submit" value="bypass" onclick="bypass ='1'">
var bypass;
function checkForm(){
if(bypass){retu rn true;}
...
normal form check code ...

Jeff


Have checkForm return true if all is good and return false if there is
an error.

This will let you use a normal submit button and will let the form
work if javascript is disabled.

Jeff

I want to be able to to press one form button without running validating script.
I just want to go directly to my php script.

I tried to do this
onclick="docume nt.form1.submit ()" but than the button value is not posted and my php script is not working.

Also I tried to remove the onSubmit handler on my form and than I add this to all my 3 buttons that will run with validation.

<input type="button" name="select" value="save" on click="return
check(this);doc ument.form1.sub mit()"It is not working I get error that Java does not support that object or method.Also the value save is not
submitted.Is there any way to fix this

Jul 20 '05 #4


Bartosz Wegrzyn wrote:

I like the idea,but I am having problems with passing the bypass value to
the script.

I have onclick="bypass ='1'"
and in my script I have

var bypass
if (bypass) {return true;}

my function...

shoutnot it be
if (bypass==1) {return true;}
Either way. 1 is true, 0 or undefined is false.

Here's my little test page:

<html>
<body>
<script type="text/javascript">
var bypass;
function checkForm(){
if(bypass){aler t('go');return true;}else{
alert('no go');return false;
}
}
</script>
<form onsubmit="retur n checkForm()" action="somewhe re.htm">
<input type="submit" value="normal" >
<input type="submit" value="bypass" onclick="bypass ='1'">
</form>
</body>
</html>

Jeff

Because this is not working.

Bart,

"Jeff Thies" <cy*******@spri ntmail.com> wrote in message
news:3F******** *******@sprintm ail.com...


Jeff Thies wrote:

> Please look at my code.
> I do validation of my form before I submit it.

Do this instead:

<form onsubmit="retur n checkForm()" ...>


I've reread your post and I think I misunderstood what you wanted. I
think you want a submit button that bypasses the onsubmit validation

Try this

<form onsubmit="retur n checkForm()" ...>
<input type="submit" value="normal" >
<input type="submit" value="bypass" onclick="bypass ='1'">
var bypass;
function checkForm(){
if(bypass){retu rn true;}
...
normal form check code ...

Jeff


Have checkForm return true if all is good and return false if there is
an error.

This will let you use a normal submit button and will let the form
work if javascript is disabled.

Jeff

>
> I want to be able to to press one form button without running validating > script.
> I just want to go directly to my php script.
>
> I tried to do this
> onclick="docume nt.form1.submit ()" but than the button value is not posted > and my php script is not working.
>
> Also I tried to remove the onSubmit handler on my form and than I add this > to all my 3 buttons that will run with validation.
>
> <input type="button" name="select" value="save" on click="return
> check(this);doc ument.form1.sub mit()"It is not working I get error that Java > does not support that object or method.Also the value save is not
> submitted.Is there any way to fix this

Jul 20 '05 #5
"Bartosz Wegrzyn" <bl*******@lexo n.ws> writes:
I like the idea,but I am having problems with passing the bypass value to
the script.

I have onclick="bypass ='1'"
It really should be
onclick="bypass =true;"
No need to use the string '1' to represent true, when there is a perfectly
good boolean value.
and in my script I have var bypass
The "var bypass" should be outside the function, as a global variable.
You might want to initialize it:
var bypass = false;
It is not important, but it makes the code easier to read (you can see
that it holds a boolean that is initially false).
if (bypass) {return true;}
This should work. The condition of an if statement is converted to a
boolean, and a non-empty string ('1') is converted to true.
The values that are converted to false are
false, null, undefined, "" (empty string), 0, and NaN (not-a-number).
my function...

shoutnot it be
if (bypass==1) {return true;}
No. If you want to compare to the string, it should be
if (bypass == '1') {return true;}
It is just simpler to use
onclick="bypass = true;"
and then just test
if (bypass) {return true;}
Because this is not working.


If it still isn't workig, try inserting an
alert(bypass)
just before the if statement, and see what value it has.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #6
"Bartosz Wegrzyn" <bl*******@lexo n.ws> wrote in message
news:IG******** *************@n ewssrv26.news.p rodigy.com...
Please look at my code.
I do validation of my form before I submit it.

I want to be able to to press one form button without running validating
script.
I just want to go directly to my php script.


Try this:

<form method="get" action="whateve r.php" onsubmit="retur n checkForm()">
<input type="submit" value="normal" >
<input type="button" value="bypass" onclick="this.f orm.submit()">
</form>

Vjekoslav
Jul 20 '05 #7
On Mon, 08 Sep 2003 11:10:48 +0200, Lasse Reichstein Nielsen wrote:
"Bartosz Wegrzyn" <bl*******@lexo n.ws> writes:
I like the idea,but I am having problems with passing the bypass value to
the script.

I have onclick="bypass ='1'"


It really should be
onclick="bypass =true;"
No need to use the string '1' to represent true, when there is a perfectly
good boolean value.
and in my script I have

var bypass


The "var bypass" should be outside the function, as a global variable.
You might want to initialize it:
var bypass = false;
It is not important, but it makes the code easier to read (you can see
that it holds a boolean that is initially false).
if (bypass) {return true;}


This should work. The condition of an if statement is converted to a
boolean, and a non-empty string ('1') is converted to true.
The values that are converted to false are
false, null, undefined, "" (empty string), 0, and NaN (not-a-number).
my function...

shoutnot it be
if (bypass==1) {return true;}


No. If you want to compare to the string, it should be
if (bypass == '1') {return true;}
It is just simpler to use
onclick="bypass = true;"
and then just test
if (bypass) {return true;}
Because this is not working.


If it still isn't workig, try inserting an
alert(bypass)
just before the if statement, and see what value it has.

/L


Thanks its working.

Jul 20 '05 #8
On Mon, 08 Sep 2003 07:39:41 +0000, Jeff Thies wrote:


Bartosz Wegrzyn wrote:

I like the idea,but I am having problems with passing the bypass value to
the script.

I have onclick="bypass ='1'"
and in my script I have

var bypass
if (bypass) {return true;}

my function...

shoutnot it be
if (bypass==1) {return true;}


Either way. 1 is true, 0 or undefined is false.

Here's my little test page:

<html>
<body>
<script type="text/javascript">
var bypass;
function checkForm(){
if(bypass){aler t('go');return true;}else{
alert('no go');return false;
}
}
</script>
<form onsubmit="retur n checkForm()" action="somewhe re.htm">
<input type="submit" value="normal" >
<input type="submit" value="bypass" onclick="bypass ='1'">
</form>
</body>
</html>

Jeff

Because this is not working.

Bart,

"Jeff Thies" <cy*******@spri ntmail.com> wrote in message
news:3F******** *******@sprintm ail.com...
>
>
> Jeff Thies wrote:
> >
> > > Please look at my code.
> > > I do validation of my form before I submit it.
> >
> > Do this instead:
> >
> > <form onsubmit="retur n checkForm()" ...>
>
> I've reread your post and I think I misunderstood what you wanted. I
> think you want a submit button that bypasses the onsubmit validation
>
> Try this
>
> <form onsubmit="retur n checkForm()" ...>
> <input type="submit" value="normal" >
> <input type="submit" value="bypass" onclick="bypass ='1'">
>
>
> var bypass;
> function checkForm(){
> if(bypass){retu rn true;}
> ...
> normal form check code ...
>
> Jeff
>
>
> >
> > Have checkForm return true if all is good and return false if there is
> > an error.
> >
> > This will let you use a normal submit button and will let the form
> > work if javascript is disabled.
> >
> > Jeff
> >
> > >
> > > I want to be able to to press one form button without running

validating
> > > script.
> > > I just want to go directly to my php script.
> > >
> > > I tried to do this
> > > onclick="docume nt.form1.submit ()" but than the button value is not

posted
> > > and my php script is not working.
> > >
> > > Also I tried to remove the onSubmit handler on my form and than I add

this
> > > to all my 3 buttons that will run with validation.
> > >
> > > <input type="button" name="select" value="save" on click="return
> > > check(this);doc ument.form1.sub mit()"It is not working I get error that

Java
> > > does not support that object or method.Also the value save is not
> > > submitted.Is there any way to fix this


Thanks I put the bypass var inside the function.

Jul 20 '05 #9

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

Similar topics

2
7628
by: monika | last post by:
Hi all... I am able to select a student's story and open it in a word doc. the teacher then corrects the story, highlight in colors the comments, strikethrough. In fact all the privileges I wanted as an editor can be achieved. This word doc gets opened in a new window ... the best part now I have 2 buttons on a page. One which would open a separate window to a word doc and another I want it to open in another asp page. since I have...
1
2868
by: techy techno | last post by:
Hii Just wanted to know how can I decorate my texboxes and Listmenu which is called from a JS file using the following code below: document.write("<SELECT NAME='cur2' ONCHANGE='cconv1();'>"); document.write("<OPTION VALUE='0.345066110642241'>Argentina Peso </OPTION>"); document.write("<OPTION VALUE='0.790200069503053'>Australia Dollar
2
2834
by: Heinrich Klein | last post by:
Hello I have got an the Unload Handler is it possible when the Browser is closed to send a Method post to a CGI program? If yes how can i do this normally i need to push a Button. Thanks for your help
1
1398
by: Pat | last post by:
Here is how I have been submiting a form to a popup window, this works fine for all netscape versions and all IE versions previous to 6.0.2800.1106. Does anyone know a different way I can submit a form to a popup window? ------------------------------------------------ <script language="JavaScript"> function new_window() { // Reference the form in this page
2
1404
by: AshuPd | last post by:
Hi all !!! I am fighting with a very interesting issue... What i need is to link a javasript with a imagebutton control which is already on a datalist. the problem is, if i place the control out of the DL it works fine but the id of the control looses its declaration as it is placed at the DL. Pl. some one give some idea to solve it... TIA Ashutosh
0
1128
by: pankaj1703 | last post by:
i am create one enquiry form after submiting the information fillup by the end user then it get thanks message. if it press back button it go to the enquiry form fill by him that i want to prevent any solution for this ...
2
5866
by: blitzztriger | last post by:
Hello!! how do i insert values into mysql , after parsing a submiting textbox?? I made the arrays, so this should be a basic insertion of them in the db, but something is missing, or in the wrong place...can anyone help me?? i didnt made anything in the VALUES (unless the POST ), because i bet the error is there (yes, the arrays are missing): $sql = "INSERT INTO dgplanets ( ID, coords , player name , alliance , name , ground , orbit ,...
5
1882
by: rodrigo21 | last post by:
I have a form that submits the form values to the same page (of the form). The database is feed from the same page that have the form in it. So the action attribute would look like this <form action="samepage.php" Right now, after submiting, the same form opens, so the user dont know if his record was submited. Saying this. How can I do to: after sumniting the form, go to another page that tells "your record is submited"
0
8746
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
8523
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
7355
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
6178
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
5649
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
4334
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2749
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
2
1975
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1737
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.