Search Results

Search found 6055 results on 243 pages for 'forms'.

Page 80/243 | < Previous Page | 76 77 78 79 80 81 82 83 84 85 86 87  | Next Page >

  • submitting a form inside a modalbox with jquery

    - by birdy
    submitting form with jQuery works $('#testform').submit(); doesn't work $('#testform').submit(function () { alert('test1'); return true; }); This is just an exmaple but at times i'd like to do stuff before submission of the form. Like for example submit the form using $.POST Update: If I keep both then the $.POST has no value because the form still gets submitted the traditional way, without ajax... $("#testform").submit(function() { $.post('/myajaxcontroller', function(data) { $('#result').html(data); }); }); $("#testform").submit();

    Read the article

  • form element not showing up after adding in through jquery

    - by ooo
    inside a jquery method (on a click event of a button) i have the following code: $(selector).html("<form action='/Tracker/CopyFood' method='post'><input type='hidden' name='Id' value=" + id + "><input class='very-small-input' type='text' name='Quantity' value='1' /> for <select name='Date'><option value='Today'>Today</option><option value='Yesterday'>Yesterday</option></select><select name='Meal'><option value='Breakfast'>Breakfast</option><option value='Lunch'>Lunch</option><option value='Dinner'>Dinner</option><option value='Evening Snack'>Evening Snack</option></select><input type='button' class='submitCopyFood' value='Add'> or <div style='display:inline' class='CancelCopy'>Cancel</div></form> "); it seems to work on the screen, but the button click "submitCopyFood" wasn't firing. When i click "View Selection Source" in firefox, i see the issue. All i see is this: <input name="Id" value="128" type="hidden"><input class="very-small-input" name="Quantity" value="1" type="text"> for <select name="Date"><option value="Today">Today</option><option value="Yesterday">Yesterday</option></select><select name="Meal"><option value="Breakfast">Breakfast</option><option value="Lunch">Lunch</option><option value="Dinner">Dinner</option><option value="Evening Snack">Evening Snack</option></select><input class="submitCopyFood" value="Add" type="button"> or <div style="display: inline;" class="CancelCopy">Cancel</div> Its like i never added the form anywhere. Is there any reason why i dont see the: <form action='/Tracker/CopyFood' method='post'> or the </form> in the source code inside the selected source. Is there something special that i need to do here?

    Read the article

  • Toggle classes with radio button in jQuery

    - by dardub
    I have a set of radio buttons where when I click a radio button, I want the label to change color or whatever. But when I click another radio button, the color goes away. Therefore I have something like this: jQuery('label').mouseup(function(){ jQuery(this).prev().attr('checked', 'checked'); jQuery('input').next().removeClass('selected'); jQuery('input:checked').next().addClass('selected'); }); if you need to see some html: <input type="radio" id="radio1" name="myRadio" value="option-1" /> <label for="radio1">Swing Gate</label> <input type="radio" id="radio2" name="myRadio" value="option-2" /> <label for="radio2">Swing Gate</label> This first removes 'selected' class from all the labels and then re-applies to only the checked labels. It works and is simple, but I was thinking this might not be the most efficient way of doing this. I imagine that javascript is iterating through each input element and using more resources than necessary. I'm curious if anyone knows of a common way of doing this more efficiently. I seem to be doing this type of thing quite often in my jQuery code. I've just been using jQuery for the past 3 months or so btw.

    Read the article

  • Re-order form fields on submit url

    - by user2521764
    I have a get form with several visible and hidden input fields. When the form is submitted, selected fileds with their values are appended to the url in the order they are placed in the form. Is there a way to re-order the parameters in the url using jQuery? Note that for the reasons of usability, I can not re-order the elements on the form itself. I know it beggs the question "why would I want to do it?", but the reason is that I will be hitting a static page, so the order of the parameters have to be exactly how they are in the static page url. For example, my form returns a url: http://someurl??names=comm&search=all&type=list while the static page has a url: http://someurl??search=all&type=list&names=comm A simplified form example is here: <form id="search_form" method="get" action="http://www.cbif.gc.ca/pls/pp/ppack.jump" > <h2>Choose which names you want to be displayed</h2> <select name="names"> <option value="comm">Common names</option> <option value="sci">Scientific names</option> </select> <h2>Choose how you want to view the results</h2> <input type="radio" name="search" value="all" id="complete" checked = "checked" /> <label for="complete" id="completeLabel">Complete list</label> <br/> <input type="radio" name="p_null" value="house" id="house" /> <label for="house" id="houseLabel">House plants only</label> <br/> <input type="radio" name="p_null" value="illust" id="illustrat" /> <label for="illustrat" id="illustratLabel">Plants with Illustrations</label> <br/> <input type="hidden" name="type" value="list" /> <input type="submit" value="Submit" /> </form> I can get form fields with values using $(#search_form).serializeArray() and massage the array like I want to, but I don't know how to set it back, i.e. modify the serialized values so that the submitted url has my order of parameters. I'm not even sure if this is the right way to go about it, so any pointers would be greatly appreciated.

    Read the article

  • problem getting a form image background

    - by Deumber
    I'm creating a datagridview transparent //I got the parent background image Bitmap parentBackGround = new Bitmap(this.Parent.BackgroundImage); //Set the area i want to create equal to the size of my grid Rectangle rect = new Rectangle(this.Location.X, this.Location.Y, this.Width, this.Height); //And draw in the entire grid the area of the background image that is cover with my grid, making a "transparent" effect. graphics.DrawImage(parentBackGround.Clone(rect, PixelFormat.Format32bppRgb), gridBounds); When the backgroundimage of the grid's parent is show in an normal layout all work ok, but if the layout is stretch, center or any other, the transparency effent gone, have you any idea to fix it?

    Read the article

  • Showing/Hiding the main form in C#

    - by DazSlayer
    I am working on a program where clicking on a button on form1 will open form2. I will then hide form1 until form2 is closed. The problem I have is that I cannot get form1 to show after form2 closes. Any ideas on how to fix this? try { Form1.ActiveForm.Hide(); AddGradeForm = new Form2(Form.NumberOfSelections); AddGradeForm.ShowDialog(); MessageBox.Show(AddGradeForm.Result.ToString()); } catch (Exception i) { Form1.ActiveForm.Hide(); AddGradeForm.Dispose(); AddGradeForm = new Form2(Form.NumberOfSelections); AddGradeForm.ShowDialog(); MessageBox.Show(AddGradeForm.Result.ToString()); } Form1.ActiveForm.Show(); ERROR: NullReferenceException was unhanded. Object reference not set to an instance of an object.

    Read the article

  • form_for called in a loop overloads IDs and associates fields and labels incorrectly

    - by Katy Levinson
    Rails likes giving all of my fields the same IDs when they are generated in a loop, and this causes trouble. <% current_user.subscriptions.each do |s| %> <div class="subscription_listing"> <%= link_to_function s.product.name, "toggle_delay(this)"%> in <%= s.calc_time_to_next_arrival %> days. <div class="modify_subscription"> <%= form_for s, :url => change_subscription_path(s) do |f| %> <%= label_tag(:q, "Days to delay:") %> <%= text_field_tag(:query) %> <%= check_box_tag(:always) %> <%= label_tag(:always, "Apply delay to all future orders") %> <%= submit_tag("Change") %> <% end %> <%= link_to 'Destroy', s, :confirm => 'Are you sure?', :method => :delete %> </div> </div> <% end %> Produces <div class="subscription_listing"> <a href="#" onclick="toggle_delay(this); return false;">Pasta</a> in 57 days. <div class="modify_subscription"> <form accept-charset="UTF-8" action="/subscriptions/7/change" class="edit_subscription" id="edit_subscription_7" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="_method" type="hidden" value="put" /><input name="authenticity_token" type="hidden" value="s5LJffuzmbEMkSrez8b3KLVmDWN/PGmDryXhp25+qc4=" /></div> <label for="q">Days to delay:</label> <input id="query" name="query" type="text" /> <input id="always" name="always" type="checkbox" value="1" /> <label for="always">Apply delay to all future orders</label> <input name="commit" type="submit" value="Change" /> </form> <a href="/subscriptions/7" data-confirm="Are you sure?" data-method="delete" rel="nofollow">Destroy</a> </div> </div> <div class="subscription_listing"> <a href="#" onclick="toggle_delay(this); return false;">Gummy Bears</a> in 57 days. <div class="modify_subscription"> <form accept-charset="UTF-8" action="/subscriptions/8/change" class="edit_subscription" id="edit_subscription_8" method="post"><div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713;" /><input name="_method" type="hidden" value="put" /><input name="authenticity_token" type="hidden" value="s5LJffuzmbEMkSrez8b3KLVmDWN/PGmDryXhp25+qc4=" /></div> <label for="q">Days to delay:</label> <input id="query" name="query" type="text" /> <input id="always" name="always" type="checkbox" value="1" /> <label for="always">Apply delay to all future orders</label> <input name="commit" type="submit" value="Change" /> </form> <a href="/subscriptions/8" data-confirm="Are you sure?" data-method="delete" rel="nofollow">Destroy</a> </div> </div> And that's a problem because now no matter which "Apply delay to all future orders" I select it always very helpfully checks the first box for me. How can I override the ID without doing something ugly and un-rails-like?

    Read the article

  • How to set up default value in symfony2 select box with data from database

    - by user172409255
    I have this code ->add('user', 'entity', array( 'class' => 'Acme\Entity\User', 'query_builder' => function(EntityRepository $er) use ($options) { return $er->createQueryBuilder('u') ->orderBy('u.name', 'ASC'); }, 'data' => $option['id'] )) Its not working public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add('description') ->add('user', 'entity', array( 'class' => 'Acme\Entity\User', 'query_builder' => function(EntityRepository $er) use ($options) { return $er->createQueryBuilder('u'); }, 'preferred_choices' => array('2') )) ; }

    Read the article

  • Transfer values from one selection box to another

    - by Tonya Cash
    I need to populate the first box with the items from a db table. Users would choose from the first box, and either drag value(items) to the second for selection, or would select items, and then click a button to move them over to the 2nd box. After that I need to update the db with the selected values/items.

    Read the article

  • Javascript - Text Input Attributes

    - by bobrusha
    I need to create a form element <input disabled type="text" value="smth" /> which is disabled by default. It enables when onmouseover occures. onmouseover="this.disabled=false;" And is disabled by onmouseout onmouseout="this.disabled=true;" What I need is to check the following. If the <input> is focused then it shouldn't be disabled. And if the form element loses focus it disables. Please help me to complete the events. <input disabled type="text" value="smth" onmouseover="this.disabled=false;" onfocus="???" onblur="???" onmouseout="if(???){this.disabled=true;}" />

    Read the article

  • How to get the right row in a sorted DataView?

    - by ZeissS
    Hi, I have a DataGrid containing a small table. Until now, I had a double click handler on this grid which iterated over all rows to find the selected one: DataTable table = (DataTable)this.dataGrid.DataSource; int selectedRow = -1; for (int i=0; i<table.Rows.Count; i++) if (this.dataGrid.IsSelected(i)) selectedRow = i; break; } if ( selectedRow != -1 ) { DataRow row = table.Rows[selectedRow]; // More code ... } Problem: When the user clicks on a column header and sort the table, table.Rows does not return the right rows. It still contains the unsorted rows. How can I get the right column?

    Read the article

  • Select multiple submit issue - POST is empty if not selected

    - by Dasun
    I have a multiple select as below. It allows me to select options as below. Assume that 3 sports are selected. When the items are select as shown above form submit is successful. But unfortunately if the sports are not selected like below when the form is submitted post is empty. Select box <select style="width: 100px; height: 80px;" class="input" id="selected_sport_list" name="selected_sport_list[]" multiple=""> <option value="2">sport 2</option> <option value="3">sport 3</option> <option value="5">sport test x</option></select> How can I make sure that when the form is submitted particular items are selected? Is it possible to use jquery to fix this ? or how? Thanks

    Read the article

  • how to don't store a repeated field of a Symfony form?

    - by user454760
    Hello everybody, I am working with Symfony 1.4 and Doctrine. I have a model A with a email field. The form of A, display an input in which the user should insert the email correctly. But as everybody know sometiemes they don't do it. To fix this i have insert an extra field in the model (and in the form), called *repeat_email* to prevent the misspellings. Then, in the validation process, after validates all the fields, i use a global validator to compare the data of the two fields. This works, but i don't want to have the email stored two times in the database (i don't want the *repeat_email*). Is there any mechanism to use it in the validation process, but not to store it in the database? Thanks,

    Read the article

  • How to set title and class in the HTML for the options of a ModelChoiceField?

    - by celopes
    I have a model class MyModel(models.Model): name = models.CharField(max_length=80, unique=True) parent = models.ForeignKey('self', null=True, blank=True) I want to render a ModelChoiceField for that model that looks like: <select name="mymodel" id="id_mymodel"> <option value="1" title="Value 1" class="">Value 1</option> <option value="2" title="Value 2" class="Value 1">Value 2</option> </select> The differences between this output and the default output for a ModelChoiceField are the title and class elements in the OPTION tag. They don't exist in ModelChoiceField's default output. For my purposes: The title element is supposed to be the Option Name. The class element is supposed to be self.parent.name. (this is my problem) So, in the HTML snippet above, Value 1 has no parent and Value 2 has a parent of Value 1. What is the best mechanism to change ModelChoiceField's default HTML output? EDIT: I understand how to create a new Widget for rendering HTML. The problem is how to render a value from the underlying model in each of the options.

    Read the article

  • javascript/html/php: Is it possible to insert a value into a form with Ajax?

    - by user1260310
    I have a form where users enter some text manually. Then I'd like to let the users choose a tag from a database through AJAX, not unlike how tag suggestions appear in the SO question form. While the div where the ajax call places the tag is inside the form, it does not seem to register and the tag is not picked up by the form. Am I missing something in my code, is this impossible or, if impossible there a better way to do this? Thanks for any suggestions. Here is code: html <form method="post" action="enterdata.php"> <input type="text" name="text">Enter text here. <div id="inserttags"></div><a href="javascript:void(0);" onclick="getTags()";>Get tags</a> <form type="button" name="submit" value="Enter Text and Tag"> </form> javascript getTags() { various Ajax goes here, then //following line inserts value into div of html document.getElementById("inserttags").innerHTML=xmlhttp.responseText; // a bit more ajax, then following pulls tag from db xmlhttp.open("GET","findtags.php",true); xmlhttp.send(); } //end function php //gettags.php //first pull tag from db. Then: echo 'input type="text" name="tag" value= "html">Enter tag'; //above output gets inserted in div and is visible on page. Though the above output is visible on page, the form does not seem to pick it up when you click "Enter Text and Tag" to submit the form.

    Read the article

  • Setting variable to value of form [drupal 6]

    - by N Schleder
    I have this form $form['title'] = array( '#type' => 'textfield', '#title' => t('Title of Notice'), '#description' => t('Use_underscores_as_spaces'), '#size' => 30, // '#required' => TRUE ); and I want whatever the user types in to be the value of $test I've tried $test = $form['title']; which gives me $test = array also I've tried $test = current($form['title']); which gives me $test = textfield $form['values']['title'] doesn't work dont know what else to try

    Read the article

  • [Rails] Accessing error_messages on form_tag

    - by aaronrussell
    I have built a custom form for creating a joining model on a has_many :through relationship. The models look roughly like this: class Team has_many :team_members has_many :members, :through => :team_members end class Member has_many :team_members has_many :teams, :through => :team_members end class TeamMember belongs_to :team belongs_to :member # and this model has some validations too end The form I have built is for selecting which members should be in a team. I won't paste the form, but it uses the form_tag method and basically sends an array of hashes which contain a member_id and a squad_number. I then update the database with an action that looks roughly like this (simplified a bit, but you get the jist): @team.transaction do @team.team_members = params[:team_members].collect{|tm| @team.team_members.new(tm)} if @team.save redirect_to ... else render :action => :members end end Everything works great but I am validating the squad_number for uniqueness and numerically. So, when any of those validations fail, how do I get access to them in my view, and how do I ascertain which of the many members it has failed on?

    Read the article

  • Multi-model form problem

    - by raphael_turtle
    (I'm just learning rails so....) I have a photo model and a gallery model, habtm associations and a join table. I'm making a photo gallery. The gallery page has a title field and description field. User creates gallery title, then goes to the photo page and checkboxes each image they want in that gallery. I get the error "undefined method `to_i' for ["1", {"title"="1"}]:Array" when trying to save/update a photo with a gallery title(with the checkbox) <% form_for @photo, :html => {:multipart => true } do |f| %> <%= f.error_messages %> <p> <%= f.label :title %> <%= f.text_field :title %> </p> <p> <%= f.label :description %> <%= f.text_area :description %> </p> <p> <%= f.label :image %> <%= f.file_field :image %> </p> <% for gallery in @photo.galleries %> <% fields_for "painting[gallery_attributes][]", gallery do |g| %> <div> <%= g.check_box :title %> <%= gallery.title %> </div> <% end %> <% end %> <p><%= submit_tag 'Update' %></p> <% end %> How much of this is horribly wrong? Can someone point me in the right direction?, I can't find any tutorials relating to this for 2.3 and above.

    Read the article

  • Trouble with jQuery Form Validation

    - by Sennheiser
    I'm making a form that has the following validation rules: no fields are "required", but if you enter an email, it must be valid, and if you enter a password, it must be at least 6 characters and match the confirm password field value. The form works flawlessly with no validation so I know it's not a PHP or HTML problem. Here's the jQuery code handling the form: $('#success').hide(); $('#pwerror').hide(); $('#emailError').hide(); $('#subSet').live('click',function() { //if any of the fields have a value if($("#chfn").val() != "" || $("#chln").val() != "" || $("#chpw").val() != "" || $("#chpw2").val() != "" || $("#chem").val() != "") { $ev = 1; $pv = 1; //validates an email if there is one, trips the valid variable flag if($("#chem").val() != "") { $("#profSet").validate({ rules: { chem: { email: true }, chpw: { required: false, minlength: 6 }, chpw2: { required: false, minlength: 6, equalTo: $("#chpw").val() } }, messages:{ chpw2: { equalTo: "Passwords must be the same." }, chpw: { minlength: "Password must be at least 6 characters." } } }); if(!($("#profSet").valid())) { $ev = 0; } } //if either password field is filled, start trying to validate it if($("#chpw").val() != "" || $("#chpw2").val() != "") { if(!($("#profSet").valid())) { $pv = 0; } } //if those two were valid if($pv == 1 && $ev == 1) { $.post('php/profSet.php', $('#profSet').serialize(), function(){ $('#profSet').hide(); $('#success').show(); }); } //if either was invalid, the error was already tripped, and this code exits here } }); The problem I'm having now is that the "passwords must be the same" error keeps getting triggered even if both fields are blank, or if they actually are the same. Therefore, the form cannot submit. Any help?

    Read the article

  • submit button on html to output result on same page

    - by amateur
    Hi, Although this seems like something very basic, but no matter what I tried I couldn't get my head around it. Basically I want a html form where a user types in their ID number in an input text box and when they hit the submit button it displays their email address which is their company ID number @ company.com, such as below <form action=""> ID Number: <input type="text" name="idnumber" /><br/> <input type="submit" value="Whats my email address" /> </form> <p>Your email address is 'idnumber'@email.com</p> Can this even be done using html or would I need to use Javascript or PHP for it? Thanks

    Read the article

  • Ruby on Rails: create records for multiple models with one form and one submit

    - by notblakeshelton
    I have a 3 models: quote, customer, and item. Each quote has one customer and one item. I would like to create a new quote, a new customer, and a new item in their respective tables when I press the submit button. I have looked at other questions and railscasts and either they don't work for my situation or I don't know how to implement them. I also want my index page to be the page where I can create everything. quote.rb class Quote < ActiveRecord::Base attr_accessible :quote_number has_one :customer has_one :item end customer.rb class Customer < ActiveRecord::Base #unsure of what to put here #a customer can have multiple quotes, so would i use: has_many :quotes #<----? end item.rb class Item < ActiveRecord::Base #also unsure about this #each item can also be in multiple quotes quotes_controller.rb class QuotesController < ApplicationController def index @quote = Quote.new @customer = Customer.new @item = item.new end def create @quote = Quote.new(params[:quote]) @quote.save @customer = Customer.new(params[:customer]) @customer.save @item = Item.new(params[:item]) @item.save end end items_controller.rb class ItemsController < ApplicationController def index end def new @item = Item.new end def create @item = Item.new(params[:item]) @item.save end end customers_controller.rb class CustomersController < ApplicationController def index end def new @customer = Customer.new end def create @customer = Customer.new(params[:customer]) @customer.save end end quotes/index.html.erb <%= form_for @quote do |f| %> <%= f.fields_for @customer do |builder| %> <%= label_tag :firstname %> <%= builder.text_field :firstname %> <%= label_tag :lastname %> <%= builder.text_field :lastname %> <% end %> <%= f.fields_for @item do |builder| %> <%= label_tag :name %> <%= builder.text_field :name %> <%= label_tag :description %> <%= builder.text_field :description %> <% end %> <%= label_tag :quote_number %> <%= f.text_field :quote_number %> <%= f.submit %> <% end %> When I try submitting that I get an error: Can't mass-assign protected attributes: item, customer So to try and fix it I updated the attr_accessible in quote.rb to include :item, :customer but then I get this error: Item(#) expected, got ActiveSupport::HashWithIndifferentAccess(#) Any help would be greatly appreciated.

    Read the article

  • Mechanize Submit Form Error: Insufficient items with name '10427'

    - by maneh
    I'm trying to submit a form with Mechanize, I have tried different ways, but the problem persists. Can anyone help me on this. Thank you in advance! This is the form I want to submit: http://www.stpairways.st/ This is the code that I'm using: def stp_airways(url): import re import mechanize br = mechanize.Browser() br.open(url) print br.title() br.select_form(name = "frmbook") br.form['TypeTrajet'] = ["1"] br.form['id_depart'] = ["11967"] br.form['id_arrivee'] = ["10427"] br.form['txtDateAller'] = "5/7/2014" br.form['txtDateRetour'] = "12/7/2014" br.form['TypePassager1u1000r0b1'] = ["1"] br.form['TypePassager2u1000r0b1'] = ["0"] br.form['TypePassager3u1000r0b1'] = ["0"] br.form['CodeIsoDeviseClient'] = ["17,20,23,24,25,26,27,28,29,30,31,33,34,36,37,64,65,67,68,70,73,80,81,95,96,103,147,151,152,159,160,162,169,170TP1TPF"] br.form['CodeIsoDeviseClient'] = ["EUR"] # submit response1 = br.submit() print response1.read()

    Read the article

  • PHP radio button check if null

    - by Dallox
    So in class we get this school task where we need to check if one of the fields in unfilled and display an error. No we did this but for some strange reason it doesnt display a error when a radio button is unchecked. (textfield null check works fine) I've tried with a friend many possabilities but they all doesnt seem to work. We have been stuck at this task for 2 hours. Now we have tried making seperate if's but that doesnt seem to work too. These are the important parts: <p> <input type="hidden" name="taal" value="false"> Choose a language <input type="radio" name="taal" value="N"> Dutch <input type="radio" name="taal" value="E"> English <input type="radio" name="taal" value="S"> Spanish if (@$_POST['taal'] == null){ echo "No Language gotten"; return; }

    Read the article

< Previous Page | 76 77 78 79 80 81 82 83 84 85 86 87  | Next Page >