473,796 Members | 2,765 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to pass the form validation error msg into the tooltip text

8 New Member
Hi,
I have a doubt whether it is possible to give the form validation error msg to the tooltip which is used for field description.

thanks in advance,

cheers,
vengo.
Mar 13 '08 #1
12 3790
gits
5,390 Recognized Expert Moderator Expert
please show your code ... what field, what tooltip do you mean?

kind regards
Mar 13 '08 #2
Vengo
8 New Member
[HTML]<form name="test" method="post">
<tr>
<td>User Name:</td><td><input type="text" name="fname" id="fname" size="30" tooltipText="Ty pe in your First Name in this box" /></td>
</tr>
<tr>
<td>Password: </td><td><input type="password" name="pwd" value="" size="30" id="pwd" tooltipText="Ty pe in your Password in this box"></td>
</tr>
<tr>
<td>&nbsp;</td><td><input type="submit" name="Submit" value="Add" class="btn"></td>
</tr>
</form>
[/HTML]
The above will be my code in which there are two fields with the tool tip displaying about the description about those fields and if i want to validate the user name i want to display those validation text in to the same tooltip, is this possible?

regds
Mar 13 '08 #3
gits
5,390 Recognized Expert Moderator Expert
in your validation function refer to the node and use the setAttribute() method:

Expand|Select|Wrap|Line Numbers
  1. node.setAttribute('tooltiptext', 'your_validation_text');
kind regards
Mar 13 '08 #4
Vengo
8 New Member
i gave the following validation, but i could get anything. is this correct?

Expand|Select|Wrap|Line Numbers
  1. <script language="javascript">
  2. function validate()
  3. {    
  4.     var form=document.test;
  5.  
  6.     if(form.fname.value == ''){
  7.         fname.setAttribute('tooltipText', 'enter user name');
  8.         form.fname.focus();
  9.         return false;
  10.     }    
  11. }    
  12. </script>    
regds
Mar 13 '08 #5
gits
5,390 Recognized Expert Moderator Expert
you should refer with the form of course ... next you should use the type attribute of the script tag since the language attribute is deprecated, and attribute names should be written in lower case ... try the following:

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. function validate() {    
  3.     var form = document.test;
  4.  
  5.     if (form.fname.value == '') {
  6.         form.fname.setAttribute('tooltiptext', 'enter user name');
  7.         form.fname.focus();
  8.         return false;
  9.     }    
  10. }    
  11. </script>
  12.  
kind regards
Mar 13 '08 #6
Vengo
8 New Member
thanx, it is working now . but you know only after some other function like after returning from the password field or something like that.
first i gave the validate on the onclick event of submit and even tried it with the onblur of user name but the validation text appears in the tooltip only after some other function like i said above.

thanks again,

regds
vengo
Mar 13 '08 #7
gits
5,390 Recognized Expert Moderator Expert
sorry ... i don't get it ;( ... could you please post the code that shows how you did it?

kind regards
Mar 13 '08 #8
Vengo
8 New Member
what i need is it should be displayed till the correct name given.

thanks
vengo
Mar 13 '08 #9
Vengo
8 New Member
(script)
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2. function validate() {   
  3.     var form = document.test;
  4.  
  5.     if (form.fname.value == '') {
  6.         form.fname.setAttribute('tooltiptext', 'enter user name');
  7.         form.fname.focus();
  8.         return false;
  9.     }   
  10. }   
  11. </script>

(html)


[HTML]<table >
<form name="test" method="post">
<tr>
<td>User Name:</td><td><input type="text" name="fname" id="fname" size="30" tooltipText="Ty pe in your First Name in this box" onblur="return validate();"/></td>
</tr>
<tr>
<td>Password: </td><td><input type="password" name="pwd" value="" size="30" id="pwd" tooltipText="Ty pe in your Password in this box"></td>
</tr>
<tr>
<td>&nbsp;</td><td><input type="submit" name="Submit" value="Add" class="btn"></td>
</tr>
</form>
</table>[/HTML]
Mar 13 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

6
6127
by: owen | last post by:
Generally speaking, what does it mean when I see a "button" with red text showing this message instead of the control I've dragged onto the web form in Design View.? (But the page works fine at runtime). Does it indicate a problem with References for example? Thanks Owen PS. replies cc'd by email appreciated. owen.southwood@mantix.com
7
3617
by: x muzuo | last post by:
Hi guys, I have got a prob of javascript form validation which just doesnt work with my ASP code. Can any one help me out please. Here is the code: {////<<head> <title>IIBO Submit Page</title> </head> <style type="text/css">
11
1682
by: Steve Cutting | last post by:
Hi all, Using the toolbox I added a tooltip provider to my form, and set the text for each of my buttons using the properties window. When I first show the form using .showdialog the tooltips work. However if I close and re-open the form the tooltips are no longer displayed. Am I missing something obvious or is this a bug ??
2
2560
by: VB Programmer | last post by:
I have several required field validators on each step of my CreateUserWizard. When I click Next it goes to the next step, even though the user hasn't typed anything in. I placed each "page" of validators in their own validation group. Any ideas why this isn't working?
2
9106
by: winnie_us99 | last post by:
Hi All, I am trying to do validation on my text field before going to the next page to create a user. It doesn't look like the next button will fire any validation. Am I missing something? Can anyone please help me with this? I am attaching my code piece. Thank you in advance for your help. Wing
9
4181
by: julie.siebel | last post by:
Hello all! As embarrassing as it is to admit this, I've been designing db driven websites using javascript and vbscript for about 6-7 years now, and I am *horrible* at form validation. To be honest I usually hire someone to do it for me, grab predone scripts and kind of hack out the parts that I need, or just do very minimal validation (e.g. this is numeric, this is alpha-numeric, etc.)
9
2434
by: timnels | last post by:
I have an issue where I have a user control that is launched into a floating form. At some point later, I allow the user to "unfloat" the user control by reparenting it on a split container in another form. Problem is if I wake a tooltip when the window is floated, and then try the same thing when it is reparented, the app crashes with " Cannot access a disposed object.Object name: 'Form'. Presumably, this is a result of the tooltips...
7
3622
ak1dnar
by: ak1dnar | last post by:
Hi, I got this scripts from this URL There is Error when i submit the form. Line: 54 Error: 'document.getElementbyID(....)' is null or not an object What is this error. Complete Files
5
2542
by: Mr. X. | last post by:
Hello. In Visual Studio 2008, there is on the toolbox -login -login, which create a login form. On that form there is a LoginButton, which click on it is evented on the "default.aspx.vb" codeBehind. How can I use the value on the codeBehind (default.aspx.vb) of UserName &
0
9524
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
10449
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
10217
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
10003
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
9047
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
7546
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
5440
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
5568
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4114
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.