html - Email an angular Js form -
i wrote form in html , have used angular js there.
nothing fancy, simple form mail to:email address
in action.
the link http://www.chami.com/tips/internet/010597i.html says should work alone mailto added action attribute.
but not work.what else need add?
<!doctype html> <html lang="en-us" ng-app="myapp"> <head> <meta charset="utf-8"> <title>form</title> <meta name="viewport"> <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.js"></script> <script type="text/javascript" src="js/script.js"></script> <link rel="stylesheet" href="css/styling.css" /> </head> <body ng-app="myapp"> <form name="userform" action="mailto:simrankaur.adept@gmail.com" ng-controller="sample" method="post" enctype="multipart/form-data" novalidate> <div class="row col-lg-offset-3"> <div class="form-group col-lg-6" ng-class="{ 'has-error': userform.name.$invalid && userform.name.$dirty}"> <label class="control-label">name</label> <input type="text" class="form-control" name="name" ng-model="user.name" ng-required="true" ng-minlength="3" placeholder="name" /> <span class="error-message" ng-show="userform.name.$dirty && userform.name.$error.required">you required provide name</span> <span class="error-message" ng-show="userform.name.$dirty && userform.name.$error.minlength">your name should contain 3 or more characters</span> </div> </div> <div class="row col-lg-offset-3"> <div class="form-group col-lg-6" ng-class="{ 'has-error': userform.email.$invalid && userform.email.$dirty }"> <label class="control-label">email</label> <input type="email" class="form-control" name="email" ng-model="user.email" ng-required="true" placeholder="email" /> <span class="error-message" ng-show="userform.email.$dirty && userform.name.$error.required">you required provide email id</span> </div> </div> <div class="row col-lg-offset-3"> <div class="form-group col-lg-6" ng-class="{ 'has-error': userform.phonenumber.$invalid && userform.phonenumber.$dirty}"> <label class="control-label">mobile number</label> <input type="text" class="form-control" name="phonenumber" ng-model="user.phonenumber" ng-minlength="10" ng-maxlength="10" ng-required='true' placeholder="10 digit mobile number" /> </div> </div> <div class="row col-lg-offset-3"> <div class="form-group col-lg-6" ng-class="{ 'has-error': userform.age.$invalid && userform.age.$dirty}"> <label class="control-label">age</label> <input type="text" class="form-control" name="age" ng-model="user.age" placeholder="age (optional)" ng-model-options="{updateon: 'blur'}" /> </div> </div> <div class="row col-lg-offset-3"> <div class="form-group col-lg-6" ng-class="{ 'has-error': userform.company.$invalid && userform.company.$dirty}"> <label class="control-label">company</label> <input type="text" class="form-control" name="company" ng-model="user.company" placeholder="company name (optional)" ng-minlength="2" /> </div> </div> <div class="row col-lg-offset-3"> <!-- <button class="btn btn-primary" ng-disabled="userform.$invalid" type="submit">save</button>--> <input type="submit" value="submit"> </div> </form> </body> </html>
mailto:
uris in form actions require browser , email client play nicely together. these rare enough make using mailto:
uris there completely impractical.
you need use http(s) uri , server side form handler (third party hosted options available).
Comments
Post a Comment