• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

sample code for validation

 
sharmila raman
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am trying to validate a page where im adding data specific to the copncerned person like name,phonenumber,occation,date .How do i write a validate method which checks that all fields are entered if not it has to displa an alert .Will be really great if anyone can help Thanks in advance .
 
Oscar Kamau
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
You may try doing it this way.


Hope this helps. Cheers.
 
Dawei Li
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if(phoneNo.length()==0||name.length()==0){ return true; }else{ return false; }
I think except Validating the field empty
It should Validate whether the user input alphabetic characters in phone field.
 
Oscar Kamau
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
You do not need to validate whether the user has entered an alphabet in the phoneNo text field. This is why:

While creating the text field instance, you specify whether the text field will accept numbers, password, alphabets etc. For example,


See this example. You can search for more. Regards
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic