forms

jquery sending form data and a json object in an ajax call

孤街醉人 提交于 2020-01-24 00:39:06
问题 I'm making a call to another ajax page, the call posts a json object. I also need to send data from a form (not using submit - I have the ajax call attached to a button which uses e.preventDeault() ). The call is as folows: var myUrl = 'sendswatch-data.php'; $.ajax({ url: myUrl, data: {'swatchid[]':swatchArray}, 'formdata':$('#orderData').serialize()}, type: "POST", error: function(xhr, statusText, errorThrown){ // Work out what the error was and display the appropriate message }, success:

Entity field - queryBuilder->select()

主宰稳场 提交于 2020-01-24 00:21:06
问题 I have a problem with entity field, query builder and OneToOne relationship. When I created entity field with query_builder in form class and when I set select ('u.id, u.username') I get exception: >need array or object, integer given. When I set select('u') is fine but I get columns with OneToOne relationship and Doctrine generates x additional SELECT queries. What do I have to do? EDIT: MORE DETAILS For example I have two entity with oneToOne relation, User and Contact: <?php namespace

Django Forms: Customizing html Output

六眼飞鱼酱① 提交于 2020-01-23 20:54:17
问题 I am using django-crispy-forms along with bootstrap to render my django forms. I want to use a file upload field like here, but I'm not sure how to get my html to output like this: <div class="fileupload fileupload-new" data-provides="fileupload"> <div class="fileupload-new thumbnail" style="width: 50px; height: 50px;"><img src="http://www.placehold.it/50x50/EFEFEF/AAAAAA" /></div> <div class="fileupload-preview fileupload-exists thumbnail" style="width: 50px; height: 50px;"></div> <span

Django Forms: Customizing html Output

北城以北 提交于 2020-01-23 20:53:46
问题 I am using django-crispy-forms along with bootstrap to render my django forms. I want to use a file upload field like here, but I'm not sure how to get my html to output like this: <div class="fileupload fileupload-new" data-provides="fileupload"> <div class="fileupload-new thumbnail" style="width: 50px; height: 50px;"><img src="http://www.placehold.it/50x50/EFEFEF/AAAAAA" /></div> <div class="fileupload-preview fileupload-exists thumbnail" style="width: 50px; height: 50px;"></div> <span

s:checkbox fieldValue always true in validation before submitting

本小妞迷上赌 提交于 2020-01-23 19:28:45
问题 I am using Struts 2 <s:checkbox /> in my form processing, along with AngularJS and jQuery. Before submitting, I need validation and until now we do this in the project: When we press Submit button, this function is called: $scope.processForm('myForm', '<s:url value="/form/validate.action" />', '<s:url value="/form/save.action" />'); , where processForm(formId, validateUrl, submitUrl) is a function defined by us: $scope.processForm = function(form, validateUrl, submitUrl) { window.scroll(0,0);

s:checkbox fieldValue always true in validation before submitting

匆匆过客 提交于 2020-01-23 19:28:26
问题 I am using Struts 2 <s:checkbox /> in my form processing, along with AngularJS and jQuery. Before submitting, I need validation and until now we do this in the project: When we press Submit button, this function is called: $scope.processForm('myForm', '<s:url value="/form/validate.action" />', '<s:url value="/form/save.action" />'); , where processForm(formId, validateUrl, submitUrl) is a function defined by us: $scope.processForm = function(form, validateUrl, submitUrl) { window.scroll(0,0);

Style form elements in Zend Framework with a default style

百般思念 提交于 2020-01-23 18:00:08
问题 I'm currently styling form elements with a custom CSS class to style text inputs differently, as in: $submit = new Zend_Form_Element_Submit('login'); $submit->setLabel('Log in') ->setAttrib('class', 'submit'); And $username = new Zend_Form_Element_Text('username'); $username->setLabel('Username') ->setAttrib('class', 'textinput'); But let's say I have multiple forms, and want to style all text elements with textinput and all submit elements with submit by default. Is there anyway to do this

Rails 4 - jQuery to hide/show form fields when radio button is moved to true

风流意气都作罢 提交于 2020-01-23 17:33:07
问题 I'm trying to figure out how to use jQuery in my Rails 4 app. I have a boolean attribute in my table. I ask a question to get a true or false answer using radio buttons in the form. If the answer is true, my objective is to ask follow up questions which are hidden until true is selected in the form. I have this form question: <%= f.input :ethics_relevance, as: :radio_buttons, :label => 'Is an ethics review relevant?' %> </div> <div id="project_ethics_relevance_content" class="content hidden">

Input values lost when form submitted with errors

血红的双手。 提交于 2020-01-23 16:57:12
问题 My form is working fine with the validations being done by PHP. I have three fields: Name, EMail and Message. Form and PHP code is within the same pgae, same page is called for validations when user submits the form. When a user submits the form, same page is called and it checks whether the form is submitted or not. If the form is submitted it then does the validations for blank entries and throws error message below the fields to inform user that field is left blank. It also shows error

How to disable submit button in jQuery if form fields have not been modified?

心不动则不痛 提交于 2020-01-23 13:57:06
问题 I have a HTML form that contains text fields, checkboxes, radiobuttons and a submit button. I'd like that submit button is enabled only if contents of fields are modified. Now here is the catch: if the user modifies field contents back to original values, the form button should be disabled again. Original field value "foo" => submit button is disabled User changes field value to "bar" => submit button becomes enabled User changes field value back to "foo" => submit button becomes disabled