please check my code is wrong or ok.it was not work .this is form validation in javascript using jsf page

please check my code is wrong or ok.it was not work .this is form validation in javascript using jsf page

<p>?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">
     <h:head>
         <title>view</title>
         <script type="text/javascript" >
        function checkForm(){
            if(document.form2["form2:uid"].value == ''){
                alert("this field not blank");
                return false;
            }
            if(document.form2["form2:uname"].value==''){
                alert("enter name");
                return false;
            }
           if(document.form2["form2:upassword"].value==''){
                alert("enter password");
                return false;
           }
           if(document.form2["form2:conform"].value==''){
                alert("enter conform password");
                return false;
           }</p>

if(document.form2["form2:upassword"].value != document.form2["form2:conform"].value){
            alert("password does not match");
            return false;
        }
        if(! document.form2["form2:emailid"].value.match(/^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-z0-9]{2,4}$/)){
            alert("email not valid");
            return false;
        }
    return true;
    }
        &lt;/script&gt;

&lt;/h:head&gt;

    &lt;h:body&gt;
        &lt;f:view&gt;
            &lt;h:form id="form2" onsubmit="return checkForm();"&gt;
                &lt;h1&gt;&lt;h:outputText value="Create/Edit"/&gt;&lt;/h1&gt;
                &lt;h:panelGrid columns="2"&gt;
                    &lt;h:outputLabel value="Uid:" for="uid" /&gt;
                    &lt;h:inputText id="uid" value="#{customerBean.customer.uid}" title="Uid" /&gt;
                    &lt;h:outputLabel value="Uname:" for="uname" /&gt;
                    &lt;h:inputText id="uname" value="#{customerBean.customer.uname}" title="Uname" /&gt;
                    &lt;h:outputLabel value="Upassword:" for="upassword" /&gt;
                    &lt;h:inputText id="upassword" value="#{customerBean.customer.upassword}" title="Upassword" /&gt;
                    &lt;h:outputLabel value="conform:" for="conform" /&gt;
                    &lt;h:inputText id="conform" value="#{customerBean.conform}" title="conform" /&gt;
                    &lt;h:outputLabel value="Emailid:" for="emailid" /&gt;
                    &lt;h:inputText id="emailid" value="#{customerBean.customer.emailid}" title="Emailid" /&gt;
                &lt;/h:panelGrid&gt;
                &lt;h:commandButton id="submit" value="create" action="#{customerBean.cusomerAdd}"/&gt;
            &lt;/h:form&gt;
        &lt;/f:view&gt;


    &lt;/h:body&gt;

</html>                                                         
View Answers

March 25, 2011 at 11:09 AM

Please visit the following link:

JSF Example









Related Tutorials/Questions & Answers:
please check my code is wrong or ok.it was not work .this is form validation in javascript using jsf page
please check my code is wrong or ok.it was not work .this is form validation in javascript using jsf page  <p>?xml version='1.0' encoding...; Please visit the following link: JSF Example
please check my code is wrong or ok.it was not work .this is form validation in javascript using jsf page
Form validation in javascript using jsf page  ?xml version='1.0...;   Please visit the following link: JSF... xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html
Advertisements
Not sure whats wrong with my code HELP PLEASE?!?!
Not sure whats wrong with my code HELP PLEASE?!?!  I cant figure out what I am doing wrong in my code can anyone help me out??? Grades ADS_TO_REPLACE_1 function computeGrade( ) { var hw, lab, midt, fin, avg; hw
Jquery form validation does not work
Jquery form validation does not work  I want to use jquery validation for my Forms tags. I also imported necessary javascript files e.g.... effect does not work. Could you please solve this problem? Thanks!   
Jquery form validation does not work
Jquery form validation does not work  I want to use jquery validation for my Forms tags. I also imported necessary javascript files e.g.... effect does not work. Could you please solve this problem? Thanks!   
Please provide jquery inline form validation for the code
Please provide jquery inline form validation for the code   <...="text/javascript" src="Datetimepicker.js"></script> <body bgcolor="white"> <form action="Student1Servlet" method="post" enctype="multipart/form
JavaScript Form Validation
JavaScript Form Validation  JavaScript Form Validation
this is my javascript code and i am not understanding the mistake in this,please help me?
this is my javascript code and i am not understanding the mistake in this,please help me?  <html> <h2>Form Validation</h2>...("please check your gender"); gen.focus
what is wrong with my JSP codes for updating a form?
what is wrong with my JSP codes for updating a form?  Hi experts, I have tried to emulate a code from a textbook but it doesn't work in my program. Hope someone can advise me where I had gone wrong. Tks. I've set up my
please send me javascript validation code - Java Beginners
please send me javascript validation code  hallo sir , please send me java script code for this html page.since i want to do validation.i am a new user in java ....please send me its urgent
What's wrong with my form? - Java Beginners
What's wrong with my form?  Dear expert, I'm having trouble with my enquiry form. Hope you can tell me where my mistake lies. Thanks. Here's my jsp code: Enquiries var objForm = new Object
Form Validation with JavaScript
Form Validation with JavaScript  I created a simple form including nine or ten fields in HTML, and i want to validate it in JavaScript. How can i do it? Thanks!!   Hi Friend,ADS_TO_REPLACE_1 Try the following code
form validation
form validation  how the form validation is done in jsf form using javaScript
Javascript validation code
Javascript validation code  Hi, I need a javascript validation code for the following fields 1)Name 2)Email 3)Mobile 4)City 5)State 6)Product type 7...,email required etc) Kindly please send me the code as soon as possible
Javascript validation code
Javascript validation code  Hi, I need a javascript validation code for the following fields 1)Name 2)Email 3)Mobile 4)City 5)State 6)Product type 7.....it should display enter the field required Kindly please send me the code
javascript form validation
javascript form validation  How to validate radio button , dropdown list and list box using onsubmit event..please give me a sample example..If we do...() { if(document.f1.choose.selectedIndex==""){ alert ( "Please select Dropdown value
What's wrong with my pagination code in JSP?
What's wrong with my pagination code in JSP?  Dear experts, I've... the above code. I have a problem here. As I'm using MsAccess, I still couldn't figure... whatever lines that NetBean IDE has given me error signal. The resulted page
How to check text in textbox using JavaScript
How to check text in textbox using JavaScript  How to check text in textbox using JavaScript I have a form in HTML that contains text feilds... me.   JavaScript validation example to check text in textfeild <
combox validation javascript code - JSP-Servlet
combox validation javascript code  hiiiiiii, I want a javascript code for combobox field validation for my Lotus Notes web page.... thnx  Hi This is the source code of combobox validation in javascript
PHP JavaScript form Validation - PHP
PHP JavaScript form Validation  Just looking for a general PHP JavaScript form Validation. How can I write external JavaScript Validation? Please suggest!  Hi Friend, 1) form Enter Name Enter Address
Form validation Using Jquery Plugin
Form validation Using Jquery Plugin  Hello sir I want to implement form validation using JQuery Plug-in. My code is : <html> <style type...">Please enter the following information</font></h3> <form
Registration page with JavaScript Validation
Registration page with JavaScript Validation   HTML Registration page with JavaScript Validation - required source code   Registration page in HTML with JavaScript Validation source code <html> <head>
HTML form validation using jquery
HTML form validation using jquery  Is there any way for validating html elements common under a class by giving its class name in jquery validation code..that means validating all elements by using its class name if those
Help needed for Form Validation please help!
Help needed for Form Validation please help!  I have created a page which has login as well as Signup fields. I validated the login part by using jsp... clicking the submit button for sign up it also goes through the jsp code and returns
Html form validation using jquery
Html form validation using jquery  Hi i am using form with html. Form elements like textbox, radio,checkbox,listbox i was used now how to validate the elements using submit jquery option
Form Validation using Regular Expressions is JavaScript
Form Validation using Regular Expressions is JavaScript... is JavaScript validation using Regular Expressions? The JavaScript Validating... be used to simplify data validation. A demonstration page and code library
how to give validation using javascript in swing
how to give validation using javascript in swing   how to give validation using javascript in swing....... can somebody give code for username and password validation using javscript and swing
javascript date validation using regex
javascript date validation using regex  Hi, I want to validate the date using javascript. Please help.   <html> <head> <title>Validating Date format</title> <script type="text/javascript">
JSF Form Validation
JSF Form Validation         ... about JSF. In this section on "JSF Form Validation" you will learn how to validate the JSF Form using tag libraries provided along with JSF 1.2
Please Provide jquery inline form validation
Please Provide jquery inline form validation  <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd...;/head> <body> <form action="LabAccountServlet" method="post"><
Form Code To Dispay Webpages On My Site
Form Code To Dispay Webpages On My Site  I want to use a form input box to display different pages on my site depending on the code the user types into the box. example: Producer Code 1234 would bring up Producer 1 page
Please help me to modify my java code from php code
Please help me to modify my java code from php code  i want to covert...) ... but this is not giving me the exact result as the above PHP code is giving. So please... <%@page import="java.sql.*"%> <form name=myname method=post
how to display jsp page containing mysql query in particular division using ajax ?my code is below bt i cundt get it properly
how to display jsp page containing mysql query in particular division using ajax ?my code is below bt i cundt get it properly   index.html <...="javascript" type="text/javascript"> function diplayFunction(){ var
web page for form registration to my department
web page for form registration to my department  I am creating web page for form registration to my department ..I have to Reprint the Application Form (i.e Download the PDf File from the Database ) , when the user gives
Html form using JavaScript to display the table content
Html form using JavaScript to display the table content  HI... want to write a Html JavaScript coding to display the content from database. can you teach me how and give me the code for that? Regards Karthik M
In JSP page, inside a javascript function, can I place a java code using scriptlet tag?
In JSP page, inside a javascript function, can I place a java code using... to checkListValue() method using scriptlet tag. My doubt here is, can I call the method checkListValue() using scriptlet tag inside the javascript function closeWind
What is wrong with my servlet?
What is wrong with my servlet?  I'd like to know which part of the code is wrong. My code is: print("code sample"); import java.util.*; import...((new Integer(qty)).intValue()); return cd; } } print("code
Creating Login Page In JSF using NetBeans
illustrates you how to create a login form in JSF using NetBeans. To create the jsp page... Creating Login Page In JSF using NetBeans  ... component tags on a page. <h:form> tag creates html form. <h
JavaScript Email Validation
; In this section we are going to check email Validation using JavaScript. JavaScript allows to perform a client side validation of email Ids in several forms... JavaScript Email Validation
Javascript Form validation Example
am giving a simple example for form validation using Javascript. ExampleADS...Javascript Form validation Example In this section we will discuss about how to validate your application form in javascript. In many applications data
Please help me to modify my java code from php code
]; } } I tried like this (see below JSP code) ... but this is not giving me the exact result as the above PHP code is giving. So please help me to convert...Modify Java code from PHP Code  i want to covert this php code int
javascript validation
javascript validation  my problem is following code is my form i want validation and for email field it will check formate useing regularexpressions..." language="javascript"> </script> <body> <form name="form
Struts validation not work properly - Struts
Struts validation not work properly  hi... i have a problem with my struts validation framework. i using struts 1.0... i have 2 page which... act as my 1st page & when it load it has 1 link [Add record] which will open
how to access element added via javascript dynamically using jsp code
javascript dynamically using the jsp code. i am adding empty records on .jsp page using javascript (by calling a below function on click event of button...how to access element added via javascript dynamically using jsp code 
force a page to go to another page using JavaScript
force a page to go to another page using JavaScript  How to force a page to go to another page using JavaScript
Ajax form validation Example
Ajax form validation Example  Hi, I want to validate my ajax form. Please give me good code for Ajax form validation. Thanks   Hi, Read... to validate form in Ajax using jQuery framework. Thanks
JSF code
need jsf code that will populate combo box values from the database  Hi, i'm new on JSf,I need jsf code that will populate combo box values from the database when the form runs
Form validation using jQuery plug in & JSP
Form validation using jQuery plug in & JSP In this tutorial, we will discuss about form validation using jQuery plug in & display of submit content using JSP. In the given below example a form is given ,whose fields  like
Email validation is JSP using JavaScript
Email validation is JSP using JavaScript...; of  form performs the validation. 1. First we will check that input field... will show you how to validate email address in you JSP program using JavaScript
Jdbc Login Page Validation using Combobox
Jdbc Login Page Validation using Combobox  I am beginer to java i am... help me to validate username and password by using combo box..... Please Help Me... to enter by using a form that asks for a UserID and Password*/ function pasuser(form

Ads