Search Posts

Category: forms

ng-submit called twice in angular form

I have gone through several questions regarding this issue, but none solved my issue I am using a form in which two submit type button calling same function. One button is send an extra variable with it on ng-click. when I submit my function is being called twice. I am using an approach told in the second answer of this question (mostly voted) I have not included controller as ng-controller in HTML <form ng-submit=”SaveContent(Form)”> <button […]

AngularJs input field validation

I have an input field on my HTML page and I want to put some validations on it. Limit the number of characters that the field can hold (say 6 maximum). The field can only contain numeric characters. the field is disabled if it does not contain 6 Zeros (000000). The field should be editable if it contains 6 Zeros (000000). <input type=”text” ng-model=”testfield” placeholder=”XXXXXX” ng-maxlength=”6″ ng-disabled=”testfield !=’000000′” ng-required=”testfield ==’000000′” ng-pattern=”/^[0-9]{6}$/”> Source: AngularJS

AngularJS process form on form click

I’m trying to submit a form when user clicks on any part of the form, and then process it using AnglujarJS. Here’s how I tried doing it: <form ng-click=”submit()” ng-app=”MyApp” ng-controller=”MyCtr”> <input type=”text” ng-model=”my_val” name=”my_val” value=”0″ style=”display: none”/> </form> var app = angular.module(‘MyApp’, []); app.controller(‘MyCtr’, function($scope) { $scope.submit = function() { $scope.my_val; // This is undefined }); }; }); The problem is that $scope does not have form values. If I replace ng-click with ng-submit, […]

form tag, created from directive does not submit

i encountered a strange behaviour that i can’t get my head around. I created a directive ‘tw-form’, that will post forms to my API as AJAX… when I tried handling the Exception of enctype=’multipart/file-data’ in this case, i just fill the action attribute, and don’t do much more. what i found, is that the form is not submitting at all!, Plunker with minimal reproducible example EDIT: also on JSFiddle note: if i copy […]

contact form using php in angularjs

html : View/contactform.html <form method=”post” role=”form” name=”myemailform” action=”sendingemail.php”> <div class=”form-group”> <input type=”text” name=”name” class=”form-control” id=”name” placeholder=”Your Name” data-rule=”minlen:4″ data-msg=”Please enter at least 4 chars” /> <div class=”validation”></div> </div> <div class=”form-group”> <input type=”email” class=”form-control” name=”email” id=”email” placeholder=”Your Email” data-rule=”email” data-msg=”Please enter a valid email” /> <div class=”validation”></div> </div> <div class=”form-group”> <input type=”text” class=”form-control” name=”subject” id=”subject” placeholder=”Subject” data-rule=”minlen:4″ data-msg=”Please enter at least 8 chars of subject” /> <div class=”validation”></div> </div> <div class=”form-group”> <textarea class=”form-control” name=”message” rows=”5″ cols=”10″ […]

Exporting from content created from doen builder open source as html

I am working with form builder: <b></b>Demo of Form builder open source: to build form for a website but I am unable to save the form or export as html. each time I refresh the page, everything created wipes off. Please, how can I save created form content rendered as html with form builder open source. I’d appreciate your help. Thanks Source: AngularJS

Dynamic form components in Angular?

I build a site in Aurelia that generates dynamic forms based off a database template. For example I have two fields that define a component and by looping through all the fields the form gets generated and has two way binding with the datasoure. For a simple example, a text box would be: Component: textbox Field: firstname Then I have a folder of all my html components defined. textbox.html file: <template> <input type=”text” value.bind=’template.value’/> <template> […]

nested ng form validated by parent form if novalidate in nested form

I have nested form with novalidate isolate-form, but when I Press Save button , it pop out nested form error and and focus nested form element as well <form flex=”100″ name=”GeneralInfoForm” class=”form-group”> <ng-form name=”nDegreeAppliedForm” novalidate isolate-form flex=”100″ layout-padding layout layout-wrap> </ng-form> <div flex=”100″ style=”text-align: right;”> <md-button class=”md-raised md-primary” ng-click=”SaveInfo()” type=”submit” >Save</md-button> </div> </form> any update ? Source: AngularJS

TypeError: Cannot read property ‘value’ of null in angular js

I am using google recaptcha before a form submit in my angular js application and it is working fine for the first time but if i try to submit the form second time(same form) it is showing the error angular.js:14525 TypeError: Cannot read property ‘value’ of null My recaptcha code is <div vc-recaptcha key=”my key here” ng-model=”letter.myRecaptchaResponse” on-create=”setRecaptchaId(widgetId)”> </div> My controller code is $scope.setRecaptchaId = function(widgetId) { $scope.recaptchaId = widgetId; return; }; $scope.letter.mresponse = vcRecaptchaService.getResponse($scope.recaptchaId); […]

Dynamic form using AngularJS, multiple values binding

I am looking for a best approach to convert a static form to an angular dynamic form. I am not sure how to bind multiple values to the same answer. The static page is available at: <div ng-repeat=”i in items”> <select ng-model=”i.answer” ng-options=” as o.title for o in i.answersAvailable” ng-visible=”y.TYPE = ‘SINGLE'”></select> <input type=”checkbox” ng-model=”i.answer” ng-visible=”y.TYPE = ‘MULTIPLE'” /> </div> The JSON file [ { “id”: 1, “title”: “Are you a student?”, “type”: “SINGLE”, […]

Next Page »