# Category: forms

## How to get an angular form to update after set value from dev console injected code?

how to How to get an angular form to update after set value from dev console injected code? So, I’m looking to automated some functions on a website that is not mine. I’m doing so with injected javascript code in the console so its all client side and several forms need to be triggered. No problem in standard javascript / html forms, but both react and angular apps, this poses a problem. For angular, they […]

## Validate form only if one or more field contains a number, Angular.JS

how to Validate form only if one or more field contains a number, Angular.JS I want to validate an order form with Angular.JS. The form dynamically adds input fields depending on how many products there are. The dynamically added input fields are used to determine how many products the user wants to purchase. I want the form to validate if either one of the fields has a value of minimum 1 (the user has to […]

## HTML form in ng-if environment

Structure of my app is like following: <div class=”parent”> <div class=”child” ng-if=”isShown”> <div class=”child-view-1″ ng-if=”!isShown”> </div> <div class=”child-view-2″ ng-if=”isShown”> </div> </div> </div> Inside child-view-2 I have form element, and of course, it is undefined in controller, probably beacuse of ng-if (as it creates child scope). isShown variable just switches divs from child-view-1 to child-view-2. What do you suggest, how can I make form visible all time in controller? Source: AngularJS

## How to reset form after submission in Angular?

I have a two field form and i want to just change the tab while submission of form and the problem is since the page is not reloading the form remains as same as previously entered. Here is my form <form name=”userForm” ng-submit=’manageBed.addBed(bedData);’ ng-hide=”manageBed.loader”> manageBed is the controller tried with $scope.userForm.$setPristine(); and also clearing bedData this.bedData={}; in controller gives that required field error. this.addBed = function(bedData) { Admin.addBed(this.bedData).then(function(data) { if (data.data.success) { app.loader = true; […]

## AngularJS 1.6.8: Unable to submit form and display success message

I have a simple query submission form with name, email and query fields and a component with a controller function having the submit function to submit the form. I am using ng-submit directive in the <form></form> tag to submit the user input and display a success message on submission. below is the code for the respective files. contact.html <div ngController=”contactController as vm”> <div class=”heading text-center”> <h1>Contact Us</h1> </div> <div> <form class=”needs-validation” id=”contactForm” novalidate method=”post” name=”vm.contactForm” […]

## How to insert new data row in table when clicked on add button with AngularJS

Roadmap: I have a form with one row of some fields and select menus. So, when I insert all the data in that form and press ADD ( + ) button, I want that information automatically added as a row in the table defined below the form. My Form: <div class=”form-inline”> <!– location form –> <div class=”form-group”> <input type=”text” placeholder=”Landmark” ng-model=”company.location.landmark”/> </div> <div class=”form-group”> <input type=”text” placeholder=”Street 1″ ng-model=”company.location.street1″/> </div> <div class=”form-group”> <input type=”text” placeholder=”Street […]

## Angular Form submit button only fires on second click

I’m building a small webpage that does some queries to an API. The query happens when the submit button is hit, if all entered data is valid. However at some point when I was adjusting the form from a set of separate elements (textbox, selectbox, button), I started having to hit “Search” once, and then hit it again for the function to fire. What is going on/how do I fix this? HTML: <div id=”search” class=”centerWrapper”> […]

## 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 […]