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.
12 3732 gits 5,390
Expert Mod 4TB
please show your code ... what field, what tooltip do you mean?
kind regards
[HTML]<form name="test" method="post">
<tr>
<td>User Name:</td><td><input type="text" name="fname" id="fname" size="30" tooltipText="Type 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="Type in your Password in this box"></td>
</tr>
<tr>
<td> </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
gits 5,390
Expert Mod 4TB
in your validation function refer to the node and use the setAttribute() method: - node.setAttribute('tooltiptext', 'your_validation_text');
kind regards
i gave the following validation, but i could get anything. is this correct? - <script language="javascript">
-
function validate()
-
{
-
var form=document.test;
-
-
if(form.fname.value == ''){
-
fname.setAttribute('tooltipText', 'enter user name');
-
form.fname.focus();
-
return false;
-
}
-
}
-
</script>
regds
gits 5,390
Expert Mod 4TB
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: -
<script type="text/javascript">
-
function validate() {
-
var form = document.test;
-
-
if (form.fname.value == '') {
-
form.fname.setAttribute('tooltiptext', 'enter user name');
-
form.fname.focus();
-
return false;
-
}
-
}
-
</script>
-
kind regards
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
gits 5,390
Expert Mod 4TB
sorry ... i don't get it ;( ... could you please post the code that shows how you did it?
kind regards
what i need is it should be displayed till the correct name given.
thanks
vengo
(script) - <script type="text/javascript">
-
function validate() {
-
var form = document.test;
-
-
if (form.fname.value == '') {
-
form.fname.setAttribute('tooltiptext', 'enter user name');
-
form.fname.focus();
-
return false;
-
}
-
}
-
</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="Type 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="Type in your Password in this box"></td>
</tr>
<tr>
<td> </td><td><input type="submit" name="Submit" value="Add" class="btn"></td>
</tr>
</form>
</table>[/HTML]
also with the following method,
[HTML] <tr>
<td> </td><td><input type="submit" name="Submit" value="Add" class="btn" onClick="return validate();"></td>
</tr>
</form>
</table>[/HTML]
regds
vengo
gits 5,390
Expert Mod 4TB
use it with the form's onsubmit handler: - onsubmit="return validate();"
and adapt the function to return true in case the check is ok: - <script type="text/javascript">
-
function validate() {
-
var ret = true;
-
var form = document.test;
-
-
if (form.fname.value == '') {
-
form.fname.setAttribute('tooltiptext', 'enter user name');
-
form.fname.focus();
-
ret = false;
-
}
-
-
return ret;
-
}
-
</script>
kind regards
Hey Gits,
thanks a lot, i think it is now working good.
thanks again,
regds
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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>...
|
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...
|
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"...
|
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...
|
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...
|
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...
|
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
|
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"...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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,...
|
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...
|
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,...
| |