FAQ Database Discussion Community


Django add an attribute class form in __init__.py

python,django,forms,django-forms
My form class from django import forms class Form(forms.Form): your_name = forms.CharField(label='Your name ', max_length=100) My app file __init__.py from django import forms from my_app.forms import Form from captcha.fields import ReCaptchaField def register(form): form.captcha=CaptchaField() register(Form) Code in __init__.py add an attribute captcha but it is not on the page. I...

Radio Button INPUT not sending the input to the PHP code

php,forms,post,radio-button
The code is given below shows the errors : <div class="field form-inline radio"> <form method="post" action=""> <div> <label><input type="radio" name="eatable" value="fruit_in"/> Fruit</label> </div> <div> <label><input type="radio" name="eatable" value="vegetable_in"/> Vegetable</label> </div> <div> <label><input type="radio" name="eatable" value="bread_in"/> Bread</label> </div> <div> <label><input type="radio"...

Dependencies in forms Symfony2

php,forms,symfony2,events,entities
I'm working on a webapplication in Symfony2. I came to a point in which I need some advice/explanation from some one more advanced in Symfony. I have a part of my database that is set up as follows: I have cards that belong to a card attribute set and consists...

Symfony2 Catchable Fatal Error: Argument 1 passed to entity Catchable Fatal Error: Argument 1 passed to entity

php,forms,symfony2,entity,symfony-2.6
I got this error and I'm stuck since many hours Catchable Fatal Error: Argument 1 passed to Thinking\ThinkBundle\Entity\InYourMind::setThinkFriend() must be an instance of Thinking\ThinkBundle\Entity\InYourMindFriend, array given, called in /var/www/html/thinkroulette/vars/vendor/symfony/symfony/src/Symfony/Component/PropertyAccess/PropertyAccessor.php on line 410 and defined I searched for this issue and lots of results came up but I wasn't capable to...

PHP Form showing unpredictable error [duplicate]

php,forms
This question already has an answer here: PHP: “Notice: Undefined variable” and “Notice: Undefined index” 11 answers The php code below echoes the image by using the variables $cat & $var, but when I fill the form & press submit, it shows following error redirecting to the same page...

Delay in JQuery Function (Button Load State)

javascript,jquery,ajax,forms,button
I have form validation set up to where it will create some Google Documents using Ajax requests and then submit the form to create an entry in a database, once everything in the form is validated. The actions to be taken after validation are specified by the submitHandler: submitHandler: function(form)...

Form with 2 submit buttons

javascript,html,forms,window.open
I have one form with 2 submit buttons. The form generates a URL. The 2 outputs of the form are: It writes a URL to a hidden div which displays when they click the Preview button, and It launches the same URL in a new window when they click the...

Form not submitted using jquery

javascript,jquery,html,forms
I have following form, <form method="post" action="test.php" id="offer1Form"> <input type="hidden" name="c" value="3883316"> <input type="hidden" name="qtyadd" id="qtyadd" value="1"> <input type="hidden" name="buyid" id="buyid" value="multi"> <input type="hidden" name="multi" id="multi" value="11,1;150,1;182,1;27,1; "> <input type="hidden" name="promocode" value="<?php echo $promote_code1?>"> <input type="hidden" name="continue" value="<?php echo "...

django: raise an error similar to EmailField

django,forms,error-handling,emailfield
When using an email field, attempting to submit a form with an invalid email address raises and error like this: What I like about this: doesn't reload the page, rather doesn't submit at all and instead displays an error the look Here is what I am able to accomplish currently...

How can I customize a drop-down list form element in django?

python,django,forms
I am creating an application in django and I have the next problem: I create a form class in django, as I show here: class A(forms.ModelForm): class Meta: model = ModelA This way, the form will show a drop-down list with ALL the elements in the modelA, but what I...

Javascript asynchronous calls to a function that updates DOM elements are overlapping and causing issues

javascript,jquery,html,ajax,forms
The context: I have a form that asks for a zipcode, state, and city. Next to each input field I have two spans, one that shows a green checkmark if the input is good, and one that shows a red x if the input is bad. Naturally only one is...

Google Analytics Event Tracking Form select

javascript,jquery,forms,google-analytics
i´m trying to track the selected option values. I´m getting this error in console when i track the form: Expected a number value for the field: "eventValue". but found: "string". html code: <select name="fornoyd_service_nybil" id="liste_nybil" class="liste"> <option value=""></option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option...

JavaScript validation on name field not working

javascript,forms,validation
I am trying to make my form validation work but I somehow can't make my name field to validate properly. When I write names in the field it will say that I need to write a proper name. What am I doing wrong? HTML: http://pastebin.com/EfNSkQkS JavaScript: http://pastebin.com/c6iUCYvr

How to not update a model until form submission in Angular?

javascript,angularjs,forms,binding
I'm looking for Angular to not update the model until the user submits the form. Or, in another way, to update the model only when the user has submitted the form. <form ng-submit="process()"> Value is : {{ model.property }} <input type="text" ng-model="model.property"> <button type="submit">Submit</button> </form> I was thinking of something...

Alfresco: Defining new Control-Params

forms,alfresco,alfresco-share
I am working on a custom form control, and need to define a new control-parameter of type string called helptext. I understand how to call it in my share-config-custom, how to use it in my custom form control, but not how to initially declare it. I see other control-params use...

Symfony 2 unable to pass entity repository to form

php,forms,symfony2,runtime-error
I have a form with a drop down and a set of checkboxes, i've used entity form field type to get the values via DB. it works with one of the entity but not with the other. i have this code seperately inside AddBadgesType there is NO AddBadges entity <?php...

AngularJS: how to save data in an html form between routes

javascript,html,angularjs,forms
I am currently working with AngularJS. Now I am wondering how can you save data in an html form between routes (angularjs routeprovider)? Does anyone has an example, experience or a link, which can help me to solve this problem? It would be nice to know, because like that a...

how to manage multiple form templates in fuelphp

php,forms,fuelphp
Hello I just migrated from CI to Fuel.... I am using Fieldset class to auto generate form in the view.... The problem i am facing is I have multiple types of form templates i.e some of my models use twitter bootstrap horizontal inline form where as few models use custom...

How do I communicate the form parameters from the template to the route in ember.js?

forms,ember.js
I have a form like this in a template: <form {{action 'add' on='submit'}}> <label for="name">Name</label> {{input value=name placeholder='Enter name' required="required"}} </form> Then I have the following route: import Ember from 'ember'; export default Ember.Route.extend({ actions: { add: function() { alert(this.get('name')); } } }); The alert is fired, but the output...

How to store php form data to a web server in a plain text file?

php,forms,server,storage
I have an assignment that calls for data entries from a php form to be stored in a plain text file on the same web server. I created the php form page and the plain text file but I am unsure how to connect the two. I've searched the internet...

Manually highlight all invalid inputs of Angular Form

javascript,angularjs,forms,validation
The task is kinda primitive. I got a simple Angular form with various inputs and I'd like to highlight invalid inputs manually (e.g. on submit action). I tried to loop over invalid inputs, assuming that they must have some method to highlight an error, but unfortunately they don't. Same with...

How to use button instead input, style input?

css,forms,jsp,servlets,post
My form: <form method="POST" action="AController"> <div class="userInput"> <table class="userInput"> <tr> <td><input type="text" id="username" name="login"></td> </tr> <tr> <td><input type="submit" id="submitRegInput" name="reg" value="Submit"></td> </tr> </table> </div> </form> I'm trying to style <input type="submit" id="submitRegInput" name="reg" value="Submit"> like this: #submitRegInput { background: no-repeat...

maxlength not working in html form input field with bootstrap

html5,forms,twitter-bootstrap,bootstrap,html-form
I am using bootstrap and currently created form with 5 tabs in it. I have a form field called layer time in which I have 3 input fields namely hours, minutes,seconds. I want to set the maxlength of 2 for each field.But it is not working when I specify it....

Form inside javascript not working

javascript,forms,table
I am using javascript to show a sort of menu box with clickable links but I changed my mind and want to use links as forms now. <script type="text/javascript"> $('.mouseon-examples div').data('powertipjq', $( [ '<table class="tabulkajazyku"><form id="myformen" action="member" method="POST"><input type="hidden" name="jazyk" value="en"><tr><td><a class="odkaz_cerveny odkaz_cerveny_block" href="#" id="mylinken"><img src="/images/flag_en.jpg" class="vlajky"><div...

Form controls not showing

c#,forms,winforms,user-interface,user-controls
I'm making a console application that shows a form. I created the form from scratch. When I run the program, the form shows, but the controls I added don't show. My code: using System; using System.Windows.Forms; using System.Drawing; namespace form { public class main { public static void Main() {...

Carrying over a user's information to a new page and then editing it

php,html,forms
I am outputting all of my user's into a table on a page I have called admincustomers.php. I am then attempting to select EDIT on a specific users record. I then route that to a page called editusers.php. I then want all of that specific users information to be outputted...

Show only the requested forms using JS

javascript,jquery,html,html5,forms
As the image below illustrates, I have two forms and two buttons. Currently all the forms are visible. How can I only show the requested form "according to the option they have selected (from the blue buttons on the top)"? So, if the user clicked on the "send an invite"...

PHP submit to self form

php,forms
I am trying to create a login page and have it to submit to itself and then redirect based on if user is authenticated. But for some reason everytime i submit, with wrong username or password, i would like it to show the log in screen again but it just...

How to change the background color of a html page using forms and php?

php,html,forms
After inputting a color of choice the page should change its background color. It should be done using html forms. <body bgcolor="<?php $_GET["color"]; ?>"> <form method="get" name="color"> Background color:<br> <input type="text" name="color"> <input type="submit" value="submit"> </form> </body> ...

delegated event on form in every table row changes only the first one

jquery,forms
I have the following delegated event installed on a checkbox inside a form that is present in every row of a table: jQuery(function() { var isChecked; $('#order-statuses-onweek tbody').on('change', 'form #order_status_p', function(event) { return $(this).parents('form').find('#order_status_s').attr('disabled', isChecked($(this))).toggleClass('disabled'); }); isChecked = function(el) { return $(el).prop('checked'); }; My problem is that no matter which...

Having Users IP Address Showing In My Email Form [duplicate]

php,html,forms,joomla
This question already has an answer here: How to get the client IP address in PHP? 13 answers Hello I have created an email form but am very unfamiliar with how to code in a section that displays a users IP address in the email that is sent. Here...

Flask submit data outside of form input fields

python,forms,input,flask,args
I'm working with Flask, and I am trying to submit some data that is not in input fields, to be added to the database. jinja code with the form(s) looks like this: {% for item in items %} <tr> <form id="adauga_{{ item.stoc_id }}" action="{{ url_for('adauga') }}" method="POST"> <td>{{ item.stoc_id }}</td>...

change the content of a select option

jquery,forms,select,text,options
I'd like to change the text shown in a select form, without changing the HTML elements. This is an example: <select class="myclass" name="myselect"> <option value="0">1</option> <option value="1">2</option> </select> I would like to change the "2" string into "TWO", for example, like: <option value="1">TWO</option> I'm not able to select the right...

Rails Get data from form (saves in database) and display it / use it again

ruby-on-rails,forms
Ok so this is a noobie question. I have made a form that saves the data to a database from a form. I want to then display the data in a view or a controller that i got from the form. Here is my code for the form. Controller: msgs_controller.rb...

Allow Button Submit on Click with jQuery

javascript,jquery,forms
I have an web page that has a submit button. My submit button looks like the following: <button type="submit" class="btn btn-primary wait-on-click"> <span>Submit</span> </button> When a user clicks the submit button, I want to disable the button and let the user know that something is happening. To do that, I...

How to save a form which has been generated by overriding __init__?

django,forms,django-forms
I have a form - class PermissionForm(forms.Form): def __init__(self, *args, **kwargs): super(PermissionForm, self).__init__(*args, **kwargs) permissions = Permissions.objects.all() for permission in permissions: self.fields[permission.name] = forms.CharField() Now since I don't know the field names, so how do I write the save method for this form?...

Form submitting even when it is returning false

javascript,html,forms
I can't seem to stop my form from submitting, even when it is shown that it is returning false. Could someone please help me spot out the error? Here is my html code: <form role="form" onsubmit="return login()" action="03_select_survey.html"> <!-- Username --> <div class="form-group"> <label for="user">Username:</label> <input type="text" class="form-control" id="user" placeholder="Enter...

Javascript - adding variables into a form submit

javascript,jquery,html,forms
I have a bit of javascript that finds an existing id and replaces it with a form. Within that form I'd like to be able to add javascript variables to the submit url. I'm not sure if that's possible or if I'm just implementing it incorrectly. $(document).ready(function () { $("#FB_cs_redirectTextBox")...

MySQL multi SELECT query into form and then UPDATE

php,mysql,forms,variables,post
What i am trying to accomplish is Getting data from MySQL database into a table only containing rows where a user forgot to log in or out(done) Change the data in the table (done) Click submit and it updates all the data in the table into the MySQL database I...

creating styled forms with html and css

html,css,forms
I'm tryin to write a form in html and css.my knowledge in html and css is not enough.i need help in creating this form.anybody have any idea how can i create this?please refer to jsfiddle.net thanks.

Javascript form sum of form inputs

javascript,jquery,html,html5,forms
I have this form working almost perfect. If I apply discount to default price is changes, if I apply taxes it autofills too. But the last field with the sum of price after discount plus taxes is not working. Any idea? Here is the code and a Fiddle <html> <body>...

How do I stop a button from triggering when the enter key is pressed? (focused)

vb.net,forms,button,focus
(I would say hello here, but Stackoverflow always removes it for some reason) My problem is that on my Visual Basic form the button that I use to close the form can be triggered by the enter key. This is a problem because my form opens a webpage that frequently...

Parsley.js - one multi steps function for all forms

javascript,jquery,forms,parsley.js
I am trying to set-up the multi steps form validation using the Parsely.js validation plugin. I followed the documentation here: "http://parsleyjs.org/doc/examples/multisteps.html" - but the only problem is I am going to have few forms that will have multi steps across the site and on some pages there will be more...

How can I make a “*required field” error message appear for a drop down menu in a validating PHP form?

php,forms,validation,drop-down-menu,server-side
I created a form using PHP. The form needs to be validated and it works for every field but the "rate our site" drop down menu. I'm using the same code from the form from other questions (name, email, etc.) for the "rate our site" drop down menu but the...

WooCommerce query quantity on product page

php,forms,woocommerce
I have a button that I've added to my product page, and I want to query the quantity in the woocommerce_quantity_input() control. For the life of me I can't find how to do that. I can get $product information, and $cart information, but I can't find how to get the...

Proper nesting of form tags in HTML

html5,forms,indentation
I am replicating a page, and wanted to know if I need to indent the form tag, if it is nested inside of a div tag. e.g. <div class="signup-form"> <form method="post"> <input type="text" value="First Name"> <input type="text" value="Last Name"> </form> Or do I write it without the indentation. e.g. <div...

I want to pop up a div after submit a form

javascript,jquery,html,forms,popupwindow
I want to pop up the #popUpDiv after submit a form Script $(document).ready(function(){ $('#form').on('submit',function(e){ e.preventDefault(); $.post('post.php', $(this).serialize(), function(response){ $('#result').html(response); $('#popUpDiv').fadeIn(); } }); }); Form code below <form id="form"> Number: <input type="text" name="number" /> <input class="show" type="submit" Value="Submit" name="submit" /> </form> Result will be display here <div id="popUpDiv" style="display:none"> <div id="result">...

Multiple AJAX forms with the same ID on the same page

javascript,php,jquery,ajax,forms
I have two AJAX newsletter subscribe forms on the same page (top and bottom). Both forms have the same ID. The top form works perfectly, however I'm unable to get the alert messages to appear in the bottom form. I found this question but wasn't sure how to implement the...

Angular submit not called when required fields not filled

javascript,angularjs,forms
I'm creating a form in Angular with Ionic. I don't want a red error class to be displayed unless a user has submitted the form. As such, my code looks like this: <form ng-submit="submit()" name="form"> <ion-radio ng-repeat="item in items" ng-model="data.type" name="type" ng-value="item.value" ng-class="{'error' : form.type.$invalid && formSubmitted }" </form> And...

Javascript - return dynamic row data with checkbox input

javascript,forms,select,checkbox,tabular
I seem to only be able to find the answer to this problem in JQuery and I would really like a pure JS solution. I have a dynamically generated table that I build from a parsed JSON file. I added a checkbox for each row. My question is, do I...

Getting a value from text input field, then displaying on POST

php,ajax,forms
I'm trying to get a value from a form, then display it on posting of the form. I can get the value to appear in the second text field, once I have chosen an option using the Ajax Auto-Select, but how do I get that value shown stored into a...

python BeautifulSoup find all input for specific form

python,html,forms,beautifulsoup,html-parsing
I'm trying to use BeautifulSoup to extract input fields for a specific form only. Extracting the form using the following: soup.find('form') Now I want to extract all input fields which are a child to that form only. How can I do that with BS?...

generic ajax form submission

javascript,php,ajax,forms
ajax/javascript problem: I have an app which consist of multiple forms. What i want to achieve is to make a generic js function to submit forms to their respective controllers by getting form id.. I m successfully getting form ids in form_id variable but m unable to use them. I...

Laravel MethodNotAllowedHttpException

php,forms,exception,laravel,request
I am currently creating a website that, once the user arrives, they are greeted by a form with which they input their unique id and DoB. Upon entering the information and clicking submit, they are sent to the main form which has only a little information on it and the...

Correct PHP contact form syntax? [duplicate]

php,forms,validation
This question already has an answer here: PHP: “Notice: Undefined variable” and “Notice: Undefined index” 11 answers I am trying to follow a PHP contact form tutorial from here! Seems pretty simple and I'm completely new to PHP. However, when running my project, I get so many "Notice" messages...

How to elegantly add and remove elements from DOM

javascript,html,forms
So I have a dynamic form where certain inputs should only become available (and visible) based upon what a user has already entered. The way I'm starting to go about it has a wrong smell. It is straightforward enough to add material to the DOM <script> function addStuffToTheDOM(s1, s2){ var...

Codeigniter Form Validation Rule for match (password)

php,forms,codeigniter,validation
I am trying to write Form validation rules in my Controller to submit Change Password form in which I am checking the old password too. I am getting the old password(current) from db and placing it in a hidden input field. My Rules are simple and are given below $config=array(...

Preg match for all phone numbers starting with 07045

php,forms,preg-match
I'm trying to add some code that prevents a form entry if the phone number starts with 07405. I've tried the following with no such luck, any ideas? HTML field: <input type="tel" name="required[phone]" placeholder="Telephone Number" data-required="strict"> PHP: case 'phone'; $phone = (sanitize_text_field($fields['phone'])); if (preg_match('07045', $phone)) { $fields['valid_phone'] = $phone; unset($fields['phone']);...

Converting form text in HTML into an array in JS

javascript,html,arrays,forms
I am attempting to create an online solver for the maximum subarray problem. https://en.wikipedia.org/wiki/Maximum_subarray_problem I planned on taking user-input numbers from a textbox and converting them into an int array in JS, however my JS does not seem to be running at all. Here is my HTML <!DOCTYPE html> <html>...

php form get parameters from url and store it until the final page

php,mysql,forms,get
I wrote a simple PHP survey application about movies and I am using one of the crowdsourcing services to collect data. In order to verify and rate workers, I have to generate VCODE (https://microworkers.com/vcode.php) in the final page and so workers can submit it as their proof of finishing my...

Updating fields of model using forms and views on Django 1.7

python,mysql,django,forms,e-commerce
In models.py my Product model is class Product(models.Model): productName = models.CharField(max_length=20, default='1',blank=False,null=False, primary_key = True) userPhone = models.CharField(max_length=20, default='1') userid = models.ForeignKey(Account, default='1',null=True) productDesc = models.TextField(blank=False,null=False, default='1') productCategory = models.ForeignKey(Category, null=False, default='1') productPrice = models.DecimalField(default='0',blank=False,null=False, max_digits=6, decimal_places=2) picture =...

Remove automaticaly entity in BD when choice value not selected (or null selected)

php,forms,symfony2,doctrine
I would like to know if symfony/doctrine can manage automaticaly the fact that instead of setting the value of my entity to null it could symply remove it. (by removing it I mean the records where the value equal null) exemple: I have a PICTURE entity linked to a VOTE...

PHP email form without Refreshing Page

php,jquery,ajax,forms,email
I am trying to set up my page so that when I a form is submitted it emails and a message is displayed without refreshing the page. I have tried to do this using jQuery/Ajax however I cannot get any emails sent now Without the Ajax/jQuery, the PHP works just...

Devise nested attributes form field not showing

ruby-on-rails,ruby,forms,ruby-on-rails-3,devise
I am having trouble viewing the nested attributes field in my form. I am in the jobs/new view and I want have a User form that creates a job as well as a user. I have everything in this answer Rails 4.0 with Devise. Nested attributes Unpermited parameters I have...

Laravel 5 How to Pass 2 Models to a Form

php,forms,laravel,model,laravel-5
I have form and i am using form model binding. My form is {!! Form::model($vehicle,['url' => '/pages/store']) !!} <table style="width:650px; margin-left: 4px;" > <tbody> <tr> <td>ID</td> <td>Model</td> <td>Brand</td> <td>License Plate</td> </tr> <tr> <td>{!! Form::text('id' ,null , ['readonly'], ['class' =>'textboxlong form-control', 'style'=>'height:23px;']) !!}</td> <td>{!! Form::text('model' ,null ,['class' =>'textboxlong...

html5 forms need php validation before inserting in to mysql?

html5,forms
My sign up form works on HTML5 inputs (email,password,username..) also using patterns . Do i need to check the inputs with php to before inserting them in to mysql?

Using PHP Variables as HTML Form Input Attributes

php,html,forms
Is it possible to use PHP variables as attributes in form inputs? I have the following variable already declared: $InStock //number of items in stock I would like to use this variable per below, but the code isn't working (the max constraint is not being applied to the field): print...

C# - Numbering lines in richTextBox Windows Forms

c#,windows,forms,lines
got a problem that can't deal with. I'm trying to number all lines in richTextBox, program does work, but it crashes when I click on my numbering button. Can anyone explain me please why? Code: public string temp = null; private void button1_Click(object sender, EventArgs e) { int i; for...

How to pass radio button value with php [closed]

javascript,php,html,forms
I want to pass the value of the selected radio to another page <div> <input type="radio" name="radio" id="return" value="return" /> <label for="return">Retour</label> </div> <div> <input type="radio" name="radio" id="oneway" value="oneway" checked /> <label for="oneway">Enkel</label> </div> </div> <div class="form-group right"> <button type="submit" class="btn medium black">Bereken rit</button> </div> I use the post method...

Ajax Request Hit or Miss with PHP SQL Submit

javascript,php,jquery,ajax,forms
I have a form, that after validation, it executes two Ajax requests and then submits the form to create an entry in a MySQL database. The two Ajax requests return URLs (links) to Google Documents which are created by upload.php. However, the Ajax request for "agenda" comes across an error...

How to handle form submission in HTML5 + Thymeleaf

html5,forms,spring-boot,thymeleaf
I have to submit a form with around 30 input parameters(text, select, datepicker ). The fields are mapped to two classes. How to map each field to get the value in the controller. HTML: <form id="searchPersonForm" action="#" th:object="${person}" method="post"> <input type="text" class="form-control" id="person_id" th:field="*{person_id}"></input> <input type="text" class="form-control" id="child_id" th:field="*{child_id}"></input> </form>...

Enter causing postback even if no submit button is present

javascript,jquery,asp.net,forms
I have a form in asp.net page. Whenever enter key is pressed the page is posted back. I don't have any submit button in my form and using javascript to submit form. <div class="row-fluid" align="center"> <a id="saveConfirm" class="textDecorationNone"> <div class="btn btn-primary"> <i class="icon-ok icon-white"></i>&nbsp;Add </div> </a> &nbsp; <asp:LinkButton ID="btnCancel" runat="server"...

Symfony form: disable “required” for a field from Twig

php,forms,symfony2,twig
I'm trying to disable the frontend HTML5 validation for a filed in a form built in Symfony. In Twig, i use this code: {{ form_widget(form.email, {'attr': {'class': 'form-control input-lg','novalidate': 'novalidate}}) }} but the field is still considered as required. What am I doing wrong?...

Gravity Forms - Show link after submission

javascript,jquery,wordpress,forms
I have a link set with display: none with the URL of a file that my users can download after correct submission of a Gravity Form. The things is I only want to show this link if submission was successfull. The only event I have found so far is gform_post_render,...

Controller method: Contact form should render different page depending on where the form is used

ruby-on-rails,ruby,forms,ruby-on-rails-4,controller
I have a contact form on a special page dedicated to this form. The dedicated controller includes: def new @message = Message.new end def create @message = Message.new(message_params) if @message.valid? MessageMailer.new_message(@message).deliver_now flash[:success] = "Thank you!" redirect_to contact_path else render 'new' end end Now I would also like to include this...

Javascript/jQuery form validation

javascript,jquery,forms,validation
I got most of this form validation to work properly but the only issue is that when the form detects an error on submit and the user corrects the mistake, the error text won't go away. This can be confusing for the user but I can't seem to figure out...

PHP: Submitting form data via $_POST works for all fields except radio buttons

php,forms,post,radio-button,radio
I am new to PHP and hope someone can help me with this. I have an HTML form with a number of inputs and textareas. On Submit I pass the form to another PHP page that generates an email with its values. For text inputs and textareas everything works as...

How to submit multiple forms with the same ID in AJAX

javascript,php,jquery,ajax,forms
There are a load of forms on the page with the same id: <form id="ok"> ... </form> <form id="ok"> ... </form> <form id="ok"> ... </form> I am using jQuery AJAX so that when the user submits one of the forms, the page doesn't refresh - the user can submit as...

Javascript into HTML form

javascript,html,forms
Hi I am trying to implement a HTML form. Let's suppose it has 4 fields- Name , Age , City (dropdown- contains A,B,C,D) and Region. I want Region field to appear only when City selected is A or B and disappears if city is changed to C and D. Could...

How can I post form into same php page and intercept it?

php,forms,post
I'm trying to submit a form to same page, so I want submit data, and then save into DB... And then update my page with new data... I do it in this way: <?php if (isset($_POST["matricola"]) && isset($_POST["pc"])){ echo "QUI"; $conn = dbConnect($USERDB, $PASSWORDDB, $NAMEDB); //seleziono il database e mi...

Modify scaffold :string for :text

ruby-on-rails,forms,scaffolding
I have a scaffold, but it fails because the text of the users is longer than string permits. So I would like to change the kind of data, rails g scaffold Dreams Dream:string for Dreams:text, It is possible?

PHP+HTML: file not loaded from form

php,html,forms
In my form a user can choose to upload a file. So, here's the correspondent field in the form. here is the html code: <p> <label>Allega fattura</label> <span class="field"> <input type="file" name="allegato_fattura" id="allegato_fattura" value="Sfoglia..." /> </span> and when the submit button is clicked, here we go: ... define("DIR_FATTURE","fatture/"); $fatturaFileName; $addedFattura...

Form validation blocking the entire page

jquery,forms,unobtrusive-validation
I have a form in an mvc application. If validation is triggered it disables every other button on the screen. I would like to allow the user to navigate away from the page where the form is, but I don't know how to do that. I tried to remove the...

Run AJAX function on form submit button after javascript confirm() cancel

javascript,jquery,ajax,wordpress,forms
I have a form where and AJAX function runs on form submission to make sure that the data in the form doesn't conflict with data in the database. If a conflict is found, the AJAX function pops up a confirm() box. If the user clicks "OK", the form is submitted....

How to use javascript to validate the input field for restricting numbers only and setting the range as maximum and minimum

javascript,html,angularjs,forms,validation
On event change the overflow value must get rejected. I have an input box in my form, where I want to restrict the user to enter only the numbers between 0 and 99999 only. But I don't want to disable the tab button functionality. The below code is working fine...

Force Uppercase on Symfony2 form text field

php,forms,symfony2
I've inherited a Symfony2 project that has a form built as such: $builder ->add('Status', 'choice', array( 'choices' => array('' => '', 'PASS' => 'PASS', 'FAIL' => 'FAIL', 'INCOMPLETE' => 'INCOMPLETE', 'DROPPED' => 'DROPPED',), 'required' => FALSE, )) ->add('First_Name', 'text', array('label'=>'First Name', 'required' => FALSE)) ->add('Last_Name', 'text', array('label'=>'Last Name', 'required' =>...

How do I create an editor template that works with existing data?

c#,asp.net,asp.net-mvc,forms,razor
I created an editor template to display text boxes included in a form. @model WebApplication1.Models.PersonViewModel <input type="text" class="form-control" name="@ViewData.TemplateInfo.HtmlFieldPrefix" value=""/> I simply want to include the 'form-control' class in all my input text boxes used to collect data for this model. public class PersonViewModel { [UIHint("_TextFormControl")] public string FirstName {...

PHP redirect page works only in localhost

php,mysql,forms,redirect
I haven't found any solutions for my problem so I decided to ask. I would like to redirect my php script page after submitting a form, so I use header at the end of my codes! Interestingly, when I test it in my localhost, it works and redirects the page...

Javascript: Resetting variable value created by form

javascript,forms,variables
I've created a form whereby the user enters details which are stored in variables or calculated depending on user entry. When clicking the button, a message will be displayed showing a message with the cost variable. The form clears but the message remains. The problem I have is that the...

jQuery - Onclick append form inputs and assign name attribute

jquery,html,forms
I have a jQuery button that every time is pressed appends the inputs below to a form. My problem is that i need a way to also give name attributes (numbers) to the new inputs that jQuery produces. 1: <input type="file"> 2: <input type="file"> 3: <input type="file"> 4: <input type="file">...

Put form fields two per line in bootstrap form

html,forms,twitter-bootstrap-3
I am using Twitter Bootstrap (version 3) and in the form, I am trying to put these fields two per line, but i cant figure it out how to do it.. Here you can see it in bootply what i have done.. <div class="col-md-10"> <div class="form-group"> <legend>1st sth</legend> <div class="col-md-2">...

Rails4 -> Change param name for select helper

ruby-on-rails,forms
I have a form that is being build from a Product model. One of the form elements is a select list that has qty/price information, the form is being posted to a Cart model: <%= form_for @product, url: add_cart_path, method: :post do |f| %> ... <%= f.select :prices, price_list %>...

javascript onblur onMouseOver calculate tax and autofill form input

javascript,php,html,html5,forms
After 2 days searching I give up. I have a form and need to add (autofill) taxes to the input total price but in a easy simple way: <form name="form" action="go.php"> <input name="cost" type="text"> <input name="costplustax" type="text" value=" here we autofill cost +19%> <input type="submit" value="ready to mysql"> I can...

Update Form Hidden Field Value wit button ID?

javascript,jquery,html,forms,twitter-bootstrap
I have a bunch of popover buttons that will open the same form. Now I need the button id value as hidden field inside the form. html buttons: <a type="button" class="pop" data-toggle="popover" id="1">Button 1</a> <a type="button" class="pop" data-toggle="popover" id="2">Button 2</a> <a type="button" class="pop" data-toggle="popover" id="3">Button 3</a> ... popover form: <div...

Rails: get f.range_field to submit null or nil as default value

ruby-on-rails,forms
In my app, I have a range_field where a user can select 0..100. But if they don't select anything, I want the form to submit "null" or nil as the value rather than a numerical value. Is this possible? If I use the below syntax, then everything works except value...

PHP sum echo result on the fly (difficult)

php,html,mysql,forms,search
This is a difficult one but easy for professionals. I have in mysql the fields: product name, mycost, sellprice and stock. Because I need to know how much I have in investment in my store by each product I created the follow on the fly calculation and is working fine:...

How can I prevent a form submission from taking me to a different page

javascript,php,html,forms
I've programmed a contact form that sends out an email with the details of the inputs. On submission,(action="send_form_email.php") it takes me to the actual PHP file page. Is there any way to prevent this? I currently use this code below to bring me back to the page where the form...

How can I prevent a specific field from submitting a form with jquery?

jquery,forms
Given the following very simplistic fiddle: http://jsfiddle.net/ofy3bhuf/ I want to prevent the form from being submitted if enter is pressed on the #no_return input, but it should be submitted as normal if return is pressed on any other input. As you see in the fiddle, I have actions on the...

Entering data into mysql database using php

php,mysql,forms,mamp
Customer will complete a form and enter a pathway where they will want the CSV to be exported to. The pathway is entered using the top section of the php (below): <form action="register.php" method="post"> Enter file pathway where CSV will be saved: <input type="text" name="username" required="required"/> <br/> <input type="submit" value="Enter"/>...

Select all input elements of a form the element belogs to

jquery,forms
I have multiple forms on a single MVC view. When a submit button on any of the forms is clicked, I need to get all the elements of type input belonging to that form and enable them. This is what I tried but doesn't seem to be working. $(this).parents('form:first').getElementsByTagName("input").prop("disabled", false);...