Friday 31 July 2015

Phonegap/Cordova Installation Process with Ionic in windows 7/8/10

Install node js from here:  http://nodejs.org/download/

Install Git from here: http://git-scm.com/downloads

During installation browse to the folder where node js is installed i.e. install git inside nodejs folder.
For example: c:\nodejs

Download Ant and Extract Ant to C:/ant
after that set Environment Variable for Ant,JAVA and Android
set ANT_HOME=C:\ant
set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_45 <PATH OF JDK>
set ANDROID_HOME=E:\Android\Androidd\sdk\tools <PATH OF SDK TOOLS>
set ANDROID_HOME=E:\Android\Androidd\sdk\platform-tools <PATH OF SDK PLATFORM TOOLS>

Install cordova:  
To install cordova run following command in command prompt
npm install –g cordova

npm install –g ionic


Create project using Ionic:

To create project in cordova run the following command in command prompt
ionic cordova start <App Name> --blank --v1/--v2

Now change your package name in config.xml file which is placed in application folder

Add platform in new created project:
ionic cordova platform add android
ionic cordova platform add ios

For run into the browser :
ionic serve

For run into the device
ionic cordova run android
ionic cordova run ios

Thursday 9 April 2015

Email Validation

Now we will see how we can validate our entered form data before submitting it to the web server.
This example shows how to validate an entered email address which means email address must contain at least an @ sign and a dot (.).


<script type="text/javascript">
<!--

Step 1 : 
function validateEmail()
{
 
   var emailID = document.myForm.EMail.value;
   atpos = emailID.indexOf("@");
   dotpos = emailID.lastIndexOf(".");
   if (atpos < 1 || ( dotpos - atpos < 2 )) 
   {
       alert("Please enter correct email ID")
       document.myForm.EMail.focus() ;
       return false;
   }
   return( true );
}

Step 2 : 

var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
if (!filter.test(email)) {
 alert('Please provide a valid email address');
 return false;
}
//-->
</script>