473,409 Members | 2,056 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,409 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 2287
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
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
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...
0
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,...

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.