Category "forms"

Prevent negative inputs in form input type="number"?

I want to restrict user input to positive numbers in an html form. I know you can set min="0", however it is possible to bypass this by manually entering a ne

Symfony-Twig: insert fontawesome icon in a form_widget

To validate a form I am using a standard: {{ form_widget(form.save, {'attr': {'class': 'btn btn-sm btn-danger'}, 'label': 'Submit form'}) }} I want to insert

JavaScript closure function not called on form submit

This has me perplexed. I have a textbox. You type something in, and press enter. JavaScript creates a read-only input element in separate form. Alongside the te

Validating Radio Buttons on Submit

I am trying to validate radio buttons on a competition, its multi-step so the radio buttons post the selection over to the entry form page. Currently having tr

How to make a real "onchange" event in HTML (no jQuery)?

Please note: I do not want to use jQuery for this (otherwise I like it) Problem: I have come to situation where I need to do some javascript function after an u

Django: Search form in Class Based ListView

I am trying to realize a Class Based ListView which displays a selection of a table set. If the site is requested the first time, the dataset should be displaye

HTML input type number JavaScript onchange fires twice?

I can't believe I couldn't find any discussion on this already... There have been questions of how to handle events from the HTML5 form element <input type="

Feeding JavaScript variables into form fields on submit

I've got this almost working but can't quite complete it. I have a jQuery datepicker on a reservation page that feeds into an "Arrival" field as mm/dd/yyyy. I a

Reflect select state in JavaScript function

In JavaScript how do you make it so that a function is ready to change at any moment? I want to make it so that when someone selects a different option from a d

Chrome ignores autocomplete="off"

I've created a web application which uses a tagbox drop down. This works great in all browsers except Chrome browser (Version 21.0.1180.89). Despite both the i

Form value to be empty if no change by user

I have a form with two inputs: <input type="text" name="keyword" value="Search" onfocus="wipe(this)"/> <input type="text" name="city" value="City" onf

Form value to be empty if no change by user

I have a form with two inputs: <input type="text" name="keyword" value="Search" onfocus="wipe(this)"/> <input type="text" name="city" value="City" onf

Submitting forms using JavaScript

I have been battling for the past two days with the evil onbeforeunload function in JavaScript. I have a function that warns the user when they are about to clo

How to keep value of selected value after form submission?

I know there are a lot of questions related to it but believe me, no solution is working for me. <form action="index" method="post" > <s

Show/Hide Checkout Fields according to answer to previous question

I use a multi-step checkout plugin. I ask customers if they have allergies, using checkboxes. The first checkbox is none followed by chicken, beef etc. I wish

onKeyUp event calculation not working on the following rows from php generated forms except the first one

-------------------------------------------------- |No|Style No|Item Desc|Qty|Unit Price|Total Price| ----------------------------------------------

How to disable autocomplete for all major browsers

How do you disable Autocomplete in the major browsers for a specific input and/or the complete form. I found this solution: <input type="text" name="foo" a

Javascript validate form is not preventing submit

I have a form and I do JavaScript validation function onsubmit: <form method="post" onsubmit="return validateForm(this.id)" action="<?php echo $PHP_SELF;

How to check multiple function in JavaScript

I have many functions written in JavaScript such as userName(), password() etc. But on submitting on the form, I have a single function return formValidator();.

IE bug triggers click for 2 buttons?

I am trying to trigger the submit button when a user presses enter. Works great for all browsers except Internet Explorer 9. Strange thing is that IE insists on