My Text box can accept all types of data like alphabets,numeric,special characters ... Should give an error message 'if space is not a valid value '
when i am clicking a button... in
asp.net with c# through javascript.(javascript validation after clicking a button).
21 16843
My Text box can accept all types of data like alphabets,numeric,special characters ... Should give an error message 'if space is not a valid value '
when i am clicking a button... in
asp.net with c# through javascript.(javascript validation after clicking a button).
This is still a JS problem. Suggest using click event and regular expressions. HTH.
please send me javascript code for that(Space validation) it is very importent in my project...
i was tryed the below code
function validate()
{
if (document.getElementById("<%=TextBox1.ClientID%>") .value=="")
{
alert("No Feild can not be blank");
document.getElementById("<%=TextBox1.ClientID%>"). focus();
return false;
}
}
this code only validate without blank but i want to without spaces validation
please help me...
please reply me for the abobe question...
please reply me for the abobe question...
Hi Kiran,
You can use Ascii value for validation... or you can use trim function to remove all spaces from your text boxes...
how to use ascii value or trim for that text box
how to use ascii value or trim for that text box
HI,
Fisrt of all tell me what you needs exactly ? do you want to put validation in which spaces not allows in textbox or you want to cheks only blank textbox validation ?? I think you don't want users to put spaces in text box.. right ? tell exact requirement than i will tell you how to use it because i have already used such validation in my project....
validation in which spaces not allows in textbox
please reply me for the above question...
gits 5,390
Expert Mod 4TB
have a look at the following example: - function validate() {
-
var field = document.getElementById("<%=TextBox1.ClientID%>");
-
var val = field.value.replace(/^\s+|\s+$/, '');
-
-
if (val.length == 0) {
-
alert('wrong value');
-
}
-
}
-
kind regards
Thank you for sending the code.
kiran
gits 5,390
Expert Mod 4TB
no problem ... does it work for you?
kind regards
If you want to validate the textboxes for space than you can use followin java script function,
function trimAll(sString)
{
while (sString.substring(0,1) == ' ')
{
sString = sString.substring(1, sString.length);
}
while (sString.substring(sString.length-1, sString.length) == ' ')
{
sString = sString.substring(0,sString.length-1);
}
return sString;
}
gits 5,390
Expert Mod 4TB
yes ... that is another way to trim a value that is done with the replace-method and a regex in the above code: - var val = field.value.replace(/^\s+|\s+$/, '');
-
it could be just one line ;)
kind regards
Ya it's true....
this will benificial for me also..
thanks....
gits 5,390
Expert Mod 4TB
Ya it's true....
this will benificial for me also..
thanks....
no problem :) ... glad when it helps you ... and a note: whenever string-operations have to be done in javascript we could try to use regex for that. the downside of it is just the 'readability' ... sometimes regex looks very 'cryptic' and hard to read ...
kind regards
no problem :) ... glad when it helps you ... and a note: whenever string-operations have to be done in javascript we could try to use regex for that. the downside of it is just the 'readability' ... sometimes regex looks very 'cryptic' and hard to read ...
kind regards
Hi,
i am using one check box in my project and when i clicks on check box one pannel opens, i have write the code for this on server side but i want to write the code of same in javascript... i mean on client side, so please give me solution for my problem....
gits 5,390
Expert Mod 4TB
Hi,
i am using one check box in my project and when i clicks on check box one pannel opens, i have write the code for this on server side but i want to write the code of same in javascript... i mean on client side, so please give me solution for my problem....
since this is a very different question and doesn't belong to this thread i would recommend you to start a new thread regarding your NEW problem in the javascript forum ...
kind regards
MOD
This is obviously a JavaScript problem thread. Moved to the JavaScript forum. Please post in the relevant forum in future.
Moderator.
This is obviously a JavaScript problem thread. Moved to the JavaScript forum. Please post in the relevant forum in future.
Moderator.
Thanks for Suggestion...
I am using your site from several days but i was using only .net section of Forums today i opens this section... so i will follow as you suggested from today...
It was addressed to the OP (kiran83), but if you benefited, you're welcome.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: NotGiven |
last post by:
I have a web form with several fields. If I copy & paste from a RTF
document into a field, the javascript validation and field length are
bypassed and cause the form to fail.
Any ideas?
|
by: dmiller23462 |
last post by:
Hi guys....I have absolutely NO IDEA what I'm doing with Javascript
but my end result is I need two text boxes to stay hidden until a
particular option is selected....I've cobbled together the...
|
by: JJ_377 |
last post by:
I want a JavaScript validation function to fire on an ASP.NET textbox's
change event.
Here's what I've been trying and it is not working. The following added
in the webform's page load event:
...
|
by: Mike P |
last post by:
I have a method that I use for Javascript validation (see below). What
I want to do is change the alert title, buttons, icon etc. Does anybody
know the correct syntax to do this?
private void...
|
by: karen987 |
last post by:
I have a comment form, on a news website, ASP page, which users fill in and it adds comments to a news article. The reader clicks on a headline and the comments open up in a new window. It already...
|
by: ll |
last post by:
Hi,
I am working with a page that has both cfform elements and 'plain
html' form elements. In particular, I am needing to validate my
textarea form field and my email text field. On one of my...
|
by: shrin |
last post by:
Hi all,
I want to use asp.net validator and javascript validation function on a single form for different fields.
also I want to execute some code on button click after the validation is completed....
|
by: jerrydigital |
last post by:
Hello,
I have a form that i use ASP to process the form to my access database. It works well but I'm struggling to get the javascript validation to work. I have posted a small version of my form...
|
by: btreddy |
last post by:
Hii Experts,
im facing a problem with the javascript validation.i've a gridview in my web form and added a footer tempalte and placed textboxes in tht tempalte ,just to add a new row to the...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
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...
|
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: 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...
|
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...
|
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...
|
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: 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...
| |