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...

Have Programming Question? Ask it here!
 
 
 


Sreenivasulu
Locale Specific Date validations through JavaScript/Ajax...
2 Answer(s)      3 years and 6 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
validations
validations  How to get All Client and server side validations in spring using jsp   Please visit the following link: Spring Validation Example
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
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
validations in javascript
validations in javascript  How do you check validations in javascript
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 - 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
Validations
Validations  Javascript validation is working fine in Internet... = "Javascript"> function checkEmail() { if (/^\w...;script language = "Javascript"> function checkEmail
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
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
Struts Validations - Framework
Struts Validations  What is the server-side validations exactly? give me on example
Date and Time Format Example
,locale);   Date today = new Date();   ... Date and Time Format Example       This Example shows you date and time format
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
Multiple Validations on jTestFields
Multiple Validations on jTestFields  Hi, I am working on an window application in which I have to validate the data of text fields, like if textbox1... then it should check whether it is valid or not. Unless all the validations
Formatting and Parsing a Time for a Locale
. This class formats and parses both date and time for any locale. To format... = DateFormat.getTimeInstance(DateFormat.MEDIUM, locale) .format(new Date...Formatting and Parsing a Time for a Locale In this section, you will learn how
struts validations - Struts
struts validations  hi friends i an getting an error in tomcat while running the application in struts validations the error in server as validation disabled plz give me reply as soon as possible.  Hi friend
listbox and textbox validations
listbox and textbox validations  hi, any one please tell me how to set validations for listbox and textboxes using bean classes? thank you   Please visit the following link: http://www.roseindia.net/jsp/user
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
Java get System Locale
Java get System Locale       In this section, you will learn how to obtain the locale. We are providing you an example which will obtain the locale of the system
Im not getting validations - Struts
Im not getting validations  I created one struts aplication im using DynaValidations I configured validation.xml and validation-rules.xml also in s-c.xml But Im unable to get validations This is my validation.xml file
Javascript validations problem
Javascript validations problem  i have attached two jsp files 1.sports1.jsp and sports.jsp files Here when i run my sports.jsp file my validation...;HTML> <head> <SCRIPT language="javascript">
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
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
<html:html locale="true">
  <%@ taglib uri="/tags/struts-bean" prefix="bean" %> <%@ taglib uri="/tags/struts-html" prefix="html" %> <%@ taglib uri="/tags/struts-logic" prefix="logic" %> <html:html locale="true"> <
Java Set Default Locale
Java Set Default Locale       Setting Default Locale Example in Java Locale can be set also in our java programs by using the method setDefault() of Locale class
Advertisements
 

 

 

DMCA.com