Locale Specific Date validations through JavaScript/Ajax...

Locale Specific Date validations through JavaScript/Ajax...

Hi,

I am developing an JSP Application which supports I18N(Internationalization). In my JSP Page, when the user selects language(It may be Chinese or French or etc.), how to manipulate date validations through JavaScript or Ajax?

Thanks in Advance, Sreenivasulu Arveti.

View Answers

October 25, 2010 at 7:00 PM

Hi,

You can write normal JavaScript validation, but change the error/information message as per your local.

It can be done in JSP file.

For example

You if your validation function is like this:

if(theform.myfield.value.length()==0){
  alert("Please enter MY Field!");
  return false;
}

You can write the above code as shown below:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>
  <TITLE>Form Validation</TITLE>
<%
String messageFormField1="Please enter MY Field!";
If(lanuage="Denmak"){
    //You can even Get this value from lanuage file.
    messageFormField1="Language translation here!"; 
}

%>
  <Script language="JavaScript">
    function validateForm(theForm){
        if(theform.myfield.value.length()==0){
          alert("<%=messageFormField1%>");
          return false;
        }

        return true;
    }
  </Script>
 </HEAD>

 <BODY>
  <form onsubmit="return validateForm(this)">
    <!-- Your form fileds and submit button HTML code -->
  </form>
 </BODY>
</HTML>

Hope above code will help you. Keep on posting your queries related to this in this post.

Thanks


October 25, 2010 at 7:29 PM

Hi,

Read more about using cookies in JSP at JSP Cookies Example tutorial page.

Thanks









Related Tutorials/Questions & Answers:
Locale Specific Date validations through JavaScript/Ajax...
Locale Specific Date validations through JavaScript/Ajax...  Hi, I....), how to manipulate date validations through JavaScript or Ajax? Thanks... JavaScript validation, but change the error/information message as per your local
start date and end date validation in javascript - Ajax
start date and end date validation in javascript  hi, i am doing web surfing project. pls guide me for my project. i want start date and end validations in javascript. end date should be greater than start date if so less than
Advertisements
Formatting and Parsing a Locale-Specific Percentage
Formatting and Parsing a Locale-Specific Percentage In this section, you will learn how to format and parse a locale-specific percentage. On the basis... are going to format a number into locale specific percentage using NumberFormat class
Formatting and Parsing Locale-Specific Currency
Formatting and Parsing Locale-Specific Currency In this section, you will learn how to format and parse the locale specific currency. Through the formatting... are going to format the number into locale specific currency using NumberFormat class
How will you load a specific locale? - Java Beginners
How will you load a specific locale?  HI, Please tell me how to load a specific locale in Java program. Thanks   Hi Friend, You can use ResourceBundle.getBundle("Locale.UK"); For more information, visit
Formatting number as per specific locale in java
Formatting number as per specific locale in java  Hi, I am trying to print the number as per locale. I tried below, but it still prints in English locale. public class loctest { public static void main(String[] args
Formatting and Parsing a Date for a Locale
Formatting and Parsing a Date for a Locale In this section, you will learn how to format and parse a date for a locale. Java has provide the utility...("MMMM d,yyyy", locale); String date = f.format(new Date()); System.out.println
javascript - Ajax
click on particular image of slide show in javascript. i used href tag but it does not work so i m posting my javascript code here below. note: in the head.... //variable that will increment through the images var step=1
Set Date Parameter to get specific value
Set Date Parameter to get specific value  How to set the date parameter or fetch a specific data records based on date? For example fetching the two or three months old records
Java Locale
Java Locale         A locale class in java api represents a specific geographical, political, or cultural region. In java computing, locale defines a set of parameters
Struts: validations code to support 2 date foramats - Struts
Struts: validations code to support 2 date foramats  What is the code in validation.xml to support 2 date formats (DD-MM-YYYY & DD/MM/YYYY ) in form. (I'm using struts 1.3
Jdatechooser : not able to fetch date in a specific format
Jdatechooser : not able to fetch date in a specific format  get date... at this website now i can't fetch date from it ina a specific format... but i am able to get date i am using netbeans i have tried all groups no one seems to know
Javascript & AJAX query - Ajax
Javascript & AJAX query  Hi This is Venu.I want the coding for javascript i.e when i select a radio button it should display a text box along with a button(suppose name the button name as Addmore).When i click
validations
validations  How to get All Client and server side validations in spring using jsp   Please visit the following link: Spring Validation Example
Formatting Date for a Locale Example
Formatting Date for a Locale Example       This example shows how to format Date using...[]) {         Locale[] locales = {Locale.UK, Locale.FRANCE, Locale.ITALIAN};         Date date
how to done calculation for dynamic generated textboxes in jquery/javascript/ajax?
how to done calculation for dynamic generated textboxes in jquery/javascript/ajax?  how to done calculation for dynamic generated textboxes in jquery/javascript/ajax
Java get default Locale
Java get default Locale       Locale object is a representation of geographical, political, or cultural region. We can get and set our default locale through the java programs
javascript - Ajax
javascript - Ajax
Java Locale
Java Locale  How will you load a specific locale?   Hi Friend, A locale is the part of a user's environment that brings together information which is specific to a user's particular country, language, or territory
validations in javascript
validations in javascript  How do you check validations in javascript
Locale class
Locale class  What is the Locale class
validations - Struts
validations  log in page with validations user name must be special character and one number and remining is alphabetes in struts
Spring Validations
Spring Validations  Hi.. i need code for validations using spring annotations
What is the Locale class?
What is the Locale class?  What do you understand about locale class in java program. thanks,   Hi, The Locale class in Java is Java application API that stands for a specific geo-location, political or cultural
Dojo/Javascript - Ajax
Dojo/Javascript  Dojo/Javascript question: I get a message that ?dijit.byId is not a function? when debugging in firebug. I usually see dijit.byId embedded in an assignment (e.g. dijit.byId(?myId?).getValue();). So I don
date
date  how to insert date using html through the combobox
date
date  how to insert date using html through the combobox
date
date  how to insert date using html through the combobox
date
date  how to insert date using html through the combobox
What is Locale - Java Beginners
What is Locale  Hi, What is Locale? Write example to show the use of Locale. Thanks   Hi Friend, A locale is the part of a user's environment that brings together information which is specific to a user's
JSP Locale
JSP Locale          JSP Locale is used to get the preferred locale of the user. A user can configure their browser with a US language locale ("en
Validations
Validations
Validations  Javascript validation is working fine in Internet... = "Javascript"> function checkEmail() { if (/^\w...;script language = "Javascript"> function checkEmail
Locale with SimpleDateFormat - Java Beginners
parameter, it will format the date according to the default Locale. import...Locale with SimpleDateFormat  What does that mean when instantiating a SimpleDateFormat object,specify a locale? Its just a good programming
Date and Time Format Example
,locale);   Date today = new Date();   ... Date and Time Format Example       This Example shows you date and time format
ModuleNotFoundError: No module named 'validations'
ModuleNotFoundError: No module named 'validations'  Hi, My Python... 'validations' How to remove the ModuleNotFoundError: No module named 'validations' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'validations'
ModuleNotFoundError: No module named 'validations'  Hi, My Python... 'validations' How to remove the ModuleNotFoundError: No module named 'validations' error? Thanks   Hi, In your python environment
java validations
" /> <script type="text/javascript"> function validateForm...; if (f.length<20) { alert("Address too short"); return false; } var q=document.retailer.contact_no.value; if (q==null || q=="") { alert
validations in struts - Struts
validations in struts  hi friends plz give me the solution its urgent... validations the error in server as "validation disabled" plz give me reply as soon... 12/22/2002 12/25/2002 The date must be between 12-22-2002
Date Example
; In this section we are discussing about the specific date using the Date...("Date object showing specific date and time");         Date particulardate1... showing specific date and time First Particular date : Fri Jan 02 05
Struts 2 Date Validator
Struts 2 Date Validator       The Date validator in the Struts 2 Framework checks whether the supplied date lies within a specific range or not. If the value supplied does not lie
database call from javaScript - Ajax
Get Time And Date
Get Time And Date       The Class  Date provides you  a specific instant in time... concrete class that helps you in parsing date in a locale-sensitive manner. This allows
Mysql Date Order By
Mysql Date Order By       Mysql Date Order By is used to sort the records of the table by specific... from 'Mysql Date Order By'. To understand Date Order By in Mysql , we create
Struts Validations - Framework
Struts Validations  What is the server-side validations exactly? give me on example
Formatting and Parsing a Time for a Locale
. This class formats and parses both date and time for any locale. To format...Formatting and Parsing a Time for a Locale In this section, you will learn how to format and parse a time for a locale. Java has provide several classes
Sql Date Conversion
Sql Date Conversion       The Tutorial illustrate an example from 'Sql Date Conversion'. To understand this, we show you an example that return you the specific format
Formatting and Parsing a Number for a Locale
Formatting and Parsing a Number for a Locale In this section, you will learn how to format and parse a number for a Locale. Formatting converts a date, time... of the date, time, number, or message. Java has provide different classes
Custom Validations - Struts
Custom Validations  Hi, I am trying to do the custom validations in struts 1.1.That is how can we plug in our own custom validations into Validator ? Can anybody tell me how to do this with a sample example. Thanks

Ads