Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Ajax 12142-Locale-Specific-Date-validations-through-JavaScript Locale Specific Date validations through JavaScript/Ajax...
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Sreenivasulu
Locale Specific Date validations through JavaScript/Ajax...
2 Answer(s)      4 years and 2 months ago
Posted in : 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.


Advertisement
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 in Advance, Sreenivasulu Arveti.   Hi, You can write normal JavaScript
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
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
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 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...", locale); String date = f.format(new Date()); System.out.println("In French
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
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
validations
validations  How to get All Client and server side validations in spring using jsp   Please visit the following link: Spring Validation Example
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
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
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
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 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
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
Locale class
Locale class  What is the Locale class
validations in javascript
validations in javascript  How do you check validations in javascript
Spring Validations
Spring Validations  Hi.. i need code for validations using spring annotations
validations - Struts
validations  log in page with validations user name must be special character and one number and remining is alphabetes in struts
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
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
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
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
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
Validations
Validations  Javascript validation is working fine in Internet... = "Javascript"> function checkEmail() { if (/^\w...;script language = "Javascript"> function checkEmail
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
 

 

 

DMCA.com