Create many forms in one component

Issue I’m trying to create many forms in one component. I’ve tried to implement this with mat-tab-groups <mat-tab-group> <mat-tab label="form1"> <form>…</form> </mat-tab> <mat-tab label="form2"> <form>…</form> </mat-tab> </mat-tab-group> I have these functions that create the forms in the ts: createForm1(){ this.form

Continue reading

send Rating via email form

Issue I’m building an email form. In this email form, there is a star rating with radio buttons: <span class=”star-rating”> <input type=”radio” name=”rating” id=”rating” value=”1″><i></i> <input type=”radio” name=”rating” id=”rating” value=”2″><i></i> <input type=”radio” name=”rating” id=”rating” value=”3″><i></i> <input type=”radio” name=”rating” id=”rating” value=”4″><i></i>

Continue reading

Form change and validity in angularjs

Issue Whenever any non-readonly input in my form changes and the form is valid, I want to do certain action. Let’s say, my form looks like <form name=”form” novalidate> <input ng-model=’input.a’ required/> <input ng-model=’input.b’ required/> <input value='{{output.p | number: 2}}’

Continue reading

angularjs – not able to invalidate input (Object doesn't support property or method '$setValidity')

Issue I try to do the following if ($scope.RetypePassword != $scope.resource.Password) { $scope.resource.Password.$setValidity(“missmatch”, false); } else { $scope.resource.Password.$setValidity(“missmatch”, true); } but fail with this error TypeError: Object doesn’t support property or method ‘$setValidity’ What can the reason be? resource.Password is

Continue reading

(Editing Angular 5) I can't get the values of the object that is in NgModel

Issue I could not get the object of this field component.html <div class=”form-group”> <input type=”number” name=”totalPrice” class=”form-control” #lastname=”ngModel”[(ngModel)]=”invoiceService.selectedInvoice.totalPrice” readonly> </div> <!– working ok –> <div class=”form-group”> <input type=”number” name=”purchases” class=”form-control” #purchases=”ngModel” [(ngModel)]=”invoiceService.selectedInvoice.purchases[‘product’]” readonly> </div><!– not working –> this the element

Continue reading

Why is my button not appearing on the page?

Issue I have this form in a partial: <%= form_for current_user.relationships.build(:followed_id => @profile.user.id) do |f| %> <div><%= f.hidden_field :followed_id %></div> <div class=”follow_button”><%= f.submit “Follow” %></div> <% end %> that is rendered to my profile view. Here is the resulting html:

Continue reading

HTML & Angular Material disable save button from outside div when form fields are empty

Issue I have the following Angular Material form with the Close and Save buttons in an outside div for design reasons: <h1 mat-dialog-title>Product Page</h1> <div mat-dialog-content> <form [formGroup]="productForm"> <mat-form-field appearance="outline"> <mat-label>Name</mat-label> <input formControlName="name" required matInput placeholder="Name" style="text-transform:uppercase"> </mat-form-field> <mat-form-field appearance="outline">

Continue reading

Get JSON data on HTML Form Submit with HTTP POST

Issue I am trying to get JSON data on click of a button Heres the HTML for it <html> <title> </title> <body> <h2> Main API – http://api.kalendern.se/api</h3> <form method="get" enctype="application/json; charset=utf-8" action="http://api.example.com" border="1"> <input type=submit value="Show Main API"> </td> </form>

Continue reading

Getting all form values by JavaScript

Issue I have form: <form onchange="allvaluestostring()"> <select name="status"> <option value="*">All</option> <option value="1">Active</option> <option value="0">Inactive</option> </select> <select name="size"> <option value="*">All</option> <option value="small">Small</option> <option value="big">Big</option> </select> </form> And the onchange action of any input in form I need to get a JavaScript

Continue reading

basic onclick button in a html form

Issue When i put a basic onclick button in a form it doesn’t work : (even with the type="button") function action(div) { var x = document.querySelector(div); if (x.style.display == ‘block’) { x.style.display = ‘none’; } else { x.style.display = ‘block’;

Continue reading

<form> action not being relative

Issue This is a pretty basic question 😀 I have an HTML at localhost/book which has a form, <form action="d" method="get"> <input name="q" placeholder="Book name"></br> <button type="submit">Search</button> </form> The d action meant to be relative to current URL, which localhost/book,

Continue reading

Angular form mode toggling

Issue lets say that we have a very basic angular reactive form, with two modes: edit and show. And in show mode input fields are disabled, and in edit mode enabled: <form [formGroup]="formGroup" (ngSubmit)="submitForm()" novalidate> <label for="fname">First name:</label><br /> <input

Continue reading

How to reset form after submit using angular?

Issue signup.component.html <form (ngSubmit)="submitSignup()" #signupForm="ngForm"> <div class="form-group"> <label for="name">Name</label> <input type="text" class="form-control" id="name" name="name" [(ngModel)]="form.name" [ngModelOptions]="{standalone: true}" required> <small class="text-danger" [hidden]="!error.name"> {{error.name}} </small> </div> <div class="form-group"> <label for="email">Email address</label> <input type="email" class="form-control" id="email" name="email" [(ngModel)]="form.email" [ngModelOptions]="{standalone: true}" required> <small class="text-danger"

Continue reading

form action inside foreach works only for the first value of php

Issue I have created a form where every time, it would store a different id during foreach loop <?php foreach ($res as $r) { ?> <form id=”clearitem” action=”clearitem.php” method=”POST” enctype=”multipart/form-data”> <input type=”text” name=”clearitem” value=”<?php echo $r[‘cart_id’];?>”> <button type=”Submit”>&times;</button> </form> <?php

Continue reading

checkbox in php with switch statement

Issue Why deos it return 2 when I check both checkboxes? How can I return a different response when both checkboxes are turn on? html: <form action="form3.php" method="POST"> <fieldset> <legend> select your team </legend> <input type="checkbox" name="punto3" value="1"> 1 </input>

Continue reading

Submit button too close to form – Bootstrap

Issue The submit button of the form tends to be soo close to the field for some reason. I am using Bootstrap by the way. Code: <div class=”row” > <div class=”col-xs-6″> <h3 class=”page-header”>Contact Email</h3> <form class=”form-group” role=”form” action=”{$_SERVER[‘PHP_SELF’]}” method=”POST”> <input

Continue reading

Get values from submitted form

Issue I have a very simple form: <form id=”toBeTranslatedForm” action=”actionpage.php” method=”POST” > <textarea name=”userInput” id=”toBeTranslatedTextArea”></textarea> <select id=”translationOptions”>//dynamically filled</select> <input type=”submit” value=”Translate” /> </form> Using Jquery I am detecting whether the form has been submitted: function outputTranslated() { $(‘#toBeTranslatedForm’).submit(function() { //do

Continue reading

Styling django filter form in html

Issue Here’s how my django filter form currently looks: And here’s my html code: <form action="" method="get" class="form-inline"> {{myfilter.form|bootstrap}} <button class="btn btn-primary" type="submit"> Search</button> </form> I am having trouble with the following: How do I bring the filters in center

Continue reading