472,971 Members | 1,897 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

onBlur validation not calling properly when press enterkey(not mouse click)

raj
hi,
i have one textbox and one save button, i have added attribute at page
load event

btnSave.Attributes.Add("onclick","return ValidateForm();");

in validationform() ,I have written like this

if(--some validation function here--)
{
----------------
return false;
--------------
}

if(window.confirm ('Are you sure to Save ?'))
return true;
else
return false;
at .aspx page i am writing

<asp:textbox id="txtCompAdj" Runat="server"
onblur="cspFormat(this,30,8,'');return false;"></asp:textbox>

now the problem i am facing that suppose cspFormat returns false(means
some error) then in that case i am getting the prompt "Are you sure to
Save ?"

i.e. the execution sequence is when we press enter key
1) validateForm()
2) cspformat(----)

if i press the button by mouse then the execution sequence is just
reverse which is perfectly write and dont provide "Are you sure to Save
?" prompt if there is any error(return false) in cspformat(---)

so what should i do to get the proper execution sequence at enter press
event as i get at mouse pree event

Nov 19 '05 #1
3 2273
raj,

Is there a reason you aren't using the built in validators?

If you use the validation objects .NET has given you and still attach your
confirmation then the confirmation "Are you sure to save?" would pop first
and then the validators would take care of everything else for you.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"raj" <Ra***********@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
hi,
i have one textbox and one save button, i have added attribute at page
load event

btnSave.Attributes.Add("onclick","return ValidateForm();");

in validationform() ,I have written like this

if(--some validation function here--)
{
----------------
return false;
--------------
}

if(window.confirm ('Are you sure to Save ?'))
return true;
else
return false;
at .aspx page i am writing

<asp:textbox id="txtCompAdj" Runat="server"
onblur="cspFormat(this,30,8,'');return false;"></asp:textbox>

now the problem i am facing that suppose cspFormat returns false(means
some error) then in that case i am getting the prompt "Are you sure to
Save ?"

i.e. the execution sequence is when we press enter key
1) validateForm()
2) cspformat(----)

if i press the button by mouse then the execution sequence is just
reverse which is perfectly write and dont provide "Are you sure to Save
?" prompt if there is any error(return false) in cspformat(---)

so what should i do to get the proper execution sequence at enter press
event as i get at mouse pree event

Nov 19 '05 #2
you should also hookup your validation code to the onsubmit event and cancel
if error

<script>
document.forms[0]onsubmit = new function {
return ValidateForm();
}
</script>

-- bruce (sqlwork.com)
"raj" <Ra***********@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
hi,
i have one textbox and one save button, i have added attribute at page
load event

btnSave.Attributes.Add("onclick","return ValidateForm();");

in validationform() ,I have written like this

if(--some validation function here--)
{
----------------
return false;
--------------
}

if(window.confirm ('Are you sure to Save ?'))
return true;
else
return false;
at .aspx page i am writing

<asp:textbox id="txtCompAdj" Runat="server"
onblur="cspFormat(this,30,8,'');return false;"></asp:textbox>

now the problem i am facing that suppose cspFormat returns false(means
some error) then in that case i am getting the prompt "Are you sure to
Save ?"

i.e. the execution sequence is when we press enter key
1) validateForm()
2) cspformat(----)

if i press the button by mouse then the execution sequence is just
reverse which is perfectly write and dont provide "Are you sure to Save
?" prompt if there is any error(return false) in cspformat(---)

so what should i do to get the proper execution sequence at enter press
event as i get at mouse pree event

Nov 19 '05 #3
raj
hi bruce,
i put ValidationForm() at onsubmit event but still its following the
same sequence ,that problem still persist,

Nov 19 '05 #4

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

Similar topics

9
by: msnews.microsoft.com | last post by:
Hello! I'm Jim by asp How can show "abc" in textbox when click one botton?
6
by: Paul Kaufman | last post by:
What do I add to the style sheet to do this? Thanks. -Paul, the CSS Newbie
1
by: Charles Shao | last post by:
How to chang bgcolor of row when mouse selected a row? I have a HTML table in the page. I hope to change <tr.bgcolor> when user clicks on a column, just like user has selected this row. How...
1
by: nikou_70 | last post by:
I have a page with image, image has some image map, I want to submit form when user mouseover that image map, my code is like this: <img src="Images/floor4.jpg"usemap="#planetmap" id="IMG1">...
2
by: VBLearner | last post by:
How to close the parent and all child forms together at once when click on parent window's close button X?
6
by: nickwang | last post by:
Hi, does any javascript framework can implement image popup tip when mouse hover an object? Mootool has a text popup tips. Is it easy to inherit it and create a popup tip with images or other...
2
by: abhilash12 | last post by:
pls help me when mouse move on the cell how can identify cell border using javascript
5
by: kimiraikkonen | last post by:
Hi, I couldn't find a necessary class which shows when mouse hovers on a link in Webbrowser control. Think of there's a status bar(text), when mouse comes on a link, the URL must be shown in...
0
by: tweakmy | last post by:
Hi to all expert, ladies coders and gentlemen coders, I m quite newbie in this. I just started vb.net not long ago..because i was too crazy bout making an application for my own phone. as for now, i...
1
by: sonysunny | last post by:
How can we display a box (like tool tip, bigger than tool tip box and can be customised) when mouse is placed over an image and disappear wen mouse removed from that image. Using javascript. ...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
3
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.