Search Results

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

Page 72/243 | < Previous Page | 68 69 70 71 72 73 74 75 76 77 78 79  | Next Page >

  • form tag - is it required on ajax sites?

    - by benpage
    i recently was working on an ASP.NET MVC site that basically serves static html and uses ajax gets to return data to the page when inputs are changed. there is actually no posting or getting from an html input tag on the pages at all. (it is a specific style of site that is not used by the general public, so having compatibility problems for people without javascript is not an issue) after designing the site, i realised that i hadn't even included any form tags. as the site does not use any direct posts or gets, and apart from it being just good html design, i wondered, in my particular situation, if there was any point to having any form tags on the page?

    Read the article

  • Rails: Different prices for different branches, association depending on two other models combined

    - by Greg Lemond
    I have three models: Service has_many :prices has_many :groups, through: prices Price belongs_to :service belongs_to :group Group has_many :prices I want to have an input field (Simple_Form) for every price. In views/services/_form.html.haml I do: simple_form_for @service do |f| simple_fields_for :groups do |g| simple_fields_for :prices do |p| p.input :price With this setup I only get input fields for already saved prices. How I can get a price field for every group? I tried to do it manually, but it got really nasty and didn't work either. Thanks for any ideas!

    Read the article

  • Jquery Serialize data

    - by Richard
    So I have several text boxes, drop down menus, and radio options on this form. When the user clicks submit i want to save ALL that information so I can put it into a database. So this is all the form's inputs <div id="reg2a"> First Name: <br/><input type="text" name="fname" /> <br/> Last Name: <br/><input type="text" name="lname" /> <br/> Address: <br/><input type="text" name="address" /> <br/> City: <br/><input type="text" name="city" /> <br/> State: <br/><input type="text" name="state" /> <br/> Zip Code: <br/><input type="text" name="zip" /> <br/> Phone Number: <br/><input type="text" name="phone" /> <br/> Fax: <br/><input type="text" name="fax" /> <br/> Email: <br/><input type="text" name="email" /> <br/> Ethnicity: <i>Used only for grant reporting purposes</i> <br/><input type="text" name="ethnicity" /> <br/><br/> Instutional Information Type (select the best option) <br/> <select name="iitype"> <option value="none">None</option> <option value="uni">University</option> <option value="commorg">Community Organization</option> </select> <br/><br/> Number of sessions willing to present: <select id="vennum_select" name="vnum"> <?php for($i=0;$i<=3;$i++) { ?> <option value="<?php echo $i ?>"><?php echo $i ?></option> <?php } ?><br/> </select><br/> Number of tables requested: <select id="tabnum_select" name="tnum"> <?php for($i=1;$i<=3;$i++) { ?> <option value="<?php echo $i ?>"><?php echo $i ?></option> <?php } ?> </select><br/><br/> Awarding of a door prize during the conference will result in a reduction in the cost of your first table. <br/><br/> I am providing a door prize for delivery during the conference of $75 or more <select id="prize_select" name="pnum"> <option value="0">No</option> <option value="1">Yes</option> </select><br/> Prize name: <input type="text" name="prize_name" /><br/> Description: <input type="text" name="descr" /><br/> Value: <input type="text" name="retail" /><br/><br/> Name of Institution: <br/><input type="text" name="institution" /> <br/><br/> Type (select the best option) <br/> <select name="type"> <option value="none">None</option> <option value="k5">K-5</option> <option value="k8">K-8</option> <option value="68">6-8</option> <option value="912">9-12</option> </select> <br/><br/> Address: <br/><input type="text" name="address_sch" /> <br/> City: <br/><input type="text" name="city_sch" /> <br/> State: <br/><input type="text" name="state_sch" /> <br/> Zip Code: <br/><input type="text" name="zip_sch" /> <br/> <form name="frm2sub" id="frm2sub" action="page3.php" method="post"> <input type="submit" name="submit" value="Submit" id="submit" /> </form> </div> This is my jquery function: $("#frm2sub").submit( function() { var values = {}; values["fname"] = $("#fname").val(); }); I can do this for each one of the input boxes but I want to give all this data to the next page. So how do I put this array into $_POST? Btw, I've tried doing var data = $("#reg2a").serialize(); and var data = $(document).serialize(); Data ended up being empty. Any ideas? Thanks

    Read the article

  • Developing a very nonstandard Drupal form

    - by monksp
    I'm creating a site for a local retail shop using Drupal. Everything's been going very smoothly up until this current bit. It's a comic shop, and I want to make a place where people can manage their own subscriptions. Since the number of different titles a customer subscribes to can vary pretty widely, I want a way to make a completely dynamic form, with people able to add as many new lines as they need and I'm really struggling with Drupal's documentation. Essentially, I'd like the final version of the page to look something like this: http://www.monksp.org/foo.html Anyone have any experience building a drupal form like this?

    Read the article

  • double accepts_nested_attributes_for

    - by sfusion
    does anyone know if it is possible to do a double nested form for. so that i could upload images to a set from an article form. e.g. Article has_many :image_sets ImageSet belongs_to :article has_many :images Image belongs_to :image_set

    Read the article

  • Livevalidation: only validate when default value is changed

    - by usr122212
    Hello there! I am validating my html form with livevalidation and everything works great except for one feature. I have a input field with a default value age, I only want the livevalidation to validate when it says something other than "age". so maybe the user will type in 20 then the validation will fire checking its things but if left as "age" it won't check it all. But as of now, it just checks everything with a validation script and this is a problem for me as I have lots of fields in my form and some of them are optional so when I hit submit, the livevalidation checks the age field as well even if the user didnt touch it to begin with. Would this be possible with livevalidation ? Thanks for the help.

    Read the article

  • CSS image for submit button - clicking image must submit form

    - by Tom
    Please help, I have a form on wordpress. I want the user to be able to click an image instead of the standard submit button. I have the image appear and the submit button disappear - but nothing happens when I click on the image. This is the code I am using: .formBuilderForm .formBuilderSubmit { clear: both; text-align: right; display:block; width:228px; height:49px; background: url(my image url) no-repeat; text-indent:-999em; Before you say "google it" or try search: I have tried the methods mentioned here: http://www.queness.com/post/798/5-techniques-to-style-buttons-using-images-and-css I've read similar posts such as this on stackoverflow but they don't solve my frustratingly simple problem. How to change input button image using CSS? Thanks for your help.

    Read the article

  • Saving a Django form with a Many2Many field with through table

    - by PhilGo20
    So I have this model with multiple Many2Many relationship. 2 of those (EventCategorizing and EventLocation are through tables/intermediary models) class Event(models.Model): """ Event information for Way-finding and Navigator application""" categories = models.ManyToManyField('EventCategorizing', null=True, blank=True, help_text="categories associated with the location") #categories associated with the location images = models.ManyToManyField(KMSImageP, null=True, blank=True) #images related to the event creator = models.ForeignKey(User, verbose_name=_('creator'), related_name="%(class)s_created") locations = models.ManyToManyField('EventLocation', null=True, blank=True) In my view, I first need to save the creator as the request user, so I use the commit=False parameter to get the form values. if event_form.is_valid(): event = event_form.save(commit=False) #we save the request user as the creator event.creator = request.user event.save() event = event_form.save_m2m() event.save() I get the following error: *** TypeError: 'EventCategorizing' instance expected I can manually add the M2M relationship to my "event" instance, but I am sure there is a simpler way. Am I missing on something ?

    Read the article

  • change maxlength depending of the option selected

    - by tuner3000
    I've seen similar questions posted and tried to change them to meet my needs but I don't know enough about javascript to do it. I need that when a user change the dropdown select, the "titre text field" maxlength is dynamically changed a, b c and d max maxlength should be 40 and e maxlength should be 2 my code is below, I don't know why but it is not working correctly: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>title page</title> </head> <body> <script type="text/javascript"> function changeValue(dropdown) { var option = dropdown.options[dropdown.selectedIndex].value, field = document.getElementById('titre'); if (option == 'a' || option == 'b' || option == 'c' || option == 'd') { field.maxLength = 40; } else if (option == 'e') { field.value = field.value.substr(0, 2); // before reducing the maxlength, make sure it contains at most two characters; you could also reset the value altogether field.maxLength = 2; } }? </script> <form action="converter.php" method="post"> <h2>Feel all field below:</h2> <div> Title: <input type="texte" name="titre" id="titre" maxLength="40"/> Format: <select id="format" name="format" onchange="changeValue(this);"> <option value="a">A</option> <option value="b">B</option> <option value="c">C</option> <option value="d">D</option> <option value="e">E</option> </select> </div> <div> <textarea name="texte" style="width: 415px; height: 155px;"></textarea> </div> <div> <input type="submit" value="OK" /> </div> </form> </body> </html>

    Read the article

  • indicate tuncation in ToolTipStatusLabel automatically

    - by harper
    I have a .NET application with a StatusStrip holding three ToolTipStatusLabels. The Text of the labels are filled from the application as they show the status. For some circumstances they can hold an empty text. When I resize the window, the ToolTipStatusLabels are hidden when they cannot be fit in the StatusStrip. I would like to have the text truncated when the label cannot be fit in the StatusStrip. The default behavior to hide the label makes it difficult to distinguish between empty text or hidden label. To indicate that the text is truncated automatically, this should be indicated with an ellipsis (...). How can this be done?

    Read the article

  • How do I add to a model when on the Show of another model?

    - by Angela
    I on the Show of "Contacts" and want, from that page, to submit a Comment that is related to the Contact. The way I understand to do it would be: <%= start_form_tag :action => "add_comment", :id => @contact %> <% text_area "comment, "body", "rows" = > 5 %> <br> <%= submit_tag %> <%= end_form_tag %> I would create a method in the Contacts controller: def add_comment Contact.find(params[:id]).comments.create(params[:comment]) end However, I feel there's a better way, but don't know what that is? I learned this on a pretty outdated book. Basically, I want to add a new object belonging to a Model while on the Show of a different Model. Would formtastic help me, and if so, how?

    Read the article

  • Submit a form and get a JSON response with jQuery

    - by Leopd
    I expect this is easy, but I'm not finding a simple explanation anywhere of how to do this. I have a standard HTML form like this: <form name="new_post" action="process_form.json" method=POST> <label>Title:</label> <input id="post_title" name="post.title" type="text" /><br/> <label>Name:</label><br/> <input id="post_name" name="post.name" type="text" /><br/> <label>Content:</label><br/> <textarea cols="40" id="post_content" name="post.content" rows="20"></textarea> <input id="new_post_submit" type="submit" value="Create" /> </form> I'd like to have javascript (using jQuery) submit the form to the form's action (process_form.json), and receive a JSON response from the server. Then I'll have a javascript function that runs in response to the JSON response, like function form_success(json) { alert('Your form submission worked'); // process json response } How do I wire up the form submit button to call my form_success method when done? Also it should override the browser's own navigation, since I don't want to leave the page. Or should I move the button out of the form to do that?

    Read the article

  • Elegant way to reverse order Formtastic nested objects?

    - by stephan.com
    I'm presenting a list of items to the user with a field for a new item, like this: - current_user.tasks.build - semantic_form_for current_user do |f| - f.semantic_fields_for :tasks do |t| - t.inputs do = t.input :_destroy, :as => :boolean, :label => '' - if t.object.new_record? = t.input :name, :label => false - else = t.object.name Which looks lovely and works like a charm. My only problem is I want the new record at the TOP of the list, not the bottom. Is there an elegant and easy way to do this, or am I going to have to do the new element separately, or loop through the list manually?

    Read the article

  • How can ishow Form in process1 from Form in process2 ?

    - by Al0NE
    Hi I'm trying to show hidden form in process1 from another one was called by : Process.Start(@"F:\MyOtherFormPath\MyOtherForm.exe",this.Handle.ToInt32()); As you can see i passed the handle number of the hidden form ,which i'm calling the "MyOtherForm" from, and i used this number to get a handle and show the hidden form from my "MyOtherForm" like this : Form newFrm = Form.FromHandle(new IntPtr(long.Parse(handleNumberOfMyHiddenForm))); newFrm.show(); But it didn't work, any way to do this . P.S: it didn't throw any exception . thanx in advanced ..

    Read the article

  • Override Django inlineformset_factory has_changed() to always return True

    - by John
    Hi, I am using the django inlineformset_factory function. a = get_object_or_404(ModelA, pk=id) FormSet = inlineformset_factory(ModelA, ModelB) if request.method == 'POST': metaform = FormSet (instance=a, data=request.POST) if metaform.is_valid(): f = metaform.save(commit=False) for instance in f: instance.updated_by = request.user instance.save() else: metaform = FormSet(instance=a) return render_to_response('nodes/form.html', {'form':metaform}) What is happening is that if I change any of the data then everything works ok and all the data gets updated. However if I don't change any of the data then the data is not updated. i.e. only entries which are changed go through the for loop to be saved. I guess this makes sense as there is no point saving data if it has not changed. However I need to go through and save every object in the form regardless of whether it has any changes on not. So my question is how do I override this so that it goes through and saves every record whether it has any changes or not? Hope this makes sense Thanks

    Read the article

  • Saving a form using autocomplete instead of select field

    - by Jason Swett
    I have a form that looks like this: <%= form_for(@appointment) do |f| %> <% if @appointment.errors.any? %> <div id="error_explanation"> <h2><%= pluralize(@appointment.errors.count, "error") %> prohibited this appointment from being saved:</h2> <ul> <% @appointment.errors.full_messages.each do |msg| %> <li><%= msg %></li> <% end %> </ul> </div> <% end %> <%= f.fields_for @client do |client_form| %> <div class="field"> <%= client_form.label :name, "Client Name" %><br /> <%= client_form.text_field :name %> </div> <% end %> As you can see, the field for @client is a text field as opposed to select field. When I try to save my form, I get this error: Client(#23852094658120) expected, got ActiveSupport::HashWithIndifferentAccess(#23852079773520) That's not surprising. It seems to me that it was expecting a select field, which it could translate into a Client object, but instead it just got a string. I know I can do Client.find( :first, :conditions => { :name => params[:name] } ) to find a Client with that name, but how do I tell my form that that's what's going on?

    Read the article

  • How to open links in new window ONLY IF the check box is checked

    - by Travis
    Here is what i have so far. I have it so they open in new windows, but i want it only if the check box is checked... <!DOCTYPE html> <html> <head> <script> function new() { if ( document.getElementById('checkbox').checked ) window.open( 'y', 'n', 't', 'New Window' ); } else { break; } var OpenNew = document.getElementById('opennew'); OpenNew.addEventListener('click', OpenWin, false ); </script> </head> <body> <p> <form name="test"> <p>Open link in a new window &nbsp; <input type="checkbox" id="checkbox" name="check" /></p> </form> </p> <p> <h2>My favorite Websites to visit</h2> <a href="http://www.youtube.com" target="new" id="y">Youtube</a><br /> <a href="http://www.newegg.com" target="new" id="n">Newegg</a><br /> <a href="http://www.twitch.tv" target="new" id="t">Twitch.tv</a><br /> </p> </body> </html> I am unsure how to actually do the if statement if it is checked then open. It does currently open in a new tab.. i just need it to be only when its checked. Any help with this will be greatly appreciated! Thanks!

    Read the article

  • jquery validation plugin doesn't seem to work ....

    - by Pandiya Chendur
    asp.net mvc's Html.BeginForm() seems to work with jquery validation plugin but the validation plugin doesn't seem to work with a form which i ve added to a page.... This works, <% using (Html.BeginForm("Login", "Registration", FormMethod.Post, new { id = "Loginform" })) {%> <fieldset> <legend>Login</legend> <p> <label for="EmailId">EmailId:</label> <%= Html.TextBox("EmailId", null, new { @class = "text_box_height_14_width_150" })%> </p> <div class="status"></div> <p> <label for="Password">Password:</label> <%= Html.Password("Password",null, new { @class = "text_box_height_14_width_150" }) %> </p> <div class="status"></div> <p> <input type="submit" value="Login" id="login" /> </p> </fieldset> <% } %> But this doesn't work, <form id="Loginform" method="post" action="Registration/Login"> <table cellpadding="0" cellspacing="0" width="100%" style="border:none;"> <tr> <td width="12%">Email Id&nbsp;:&nbsp;</td><td width="15%"> <input id="EmailId" type="text" class="text_box_height_14_width_150 name="EmailId" /></td><td width="20%" class="status"></td> <td width="12%">Password&nbsp;:&nbsp;<td width="15%"><input id="Password" type="password" class="text_box_height_14_width_150 name="Password" /></td> <td width="20%" class="status"></td> <td width="5%"><input type="submit" value="Login" id="BtnLogin" /></td> </tr> </table> </form> and my jquery function has this, $(document).ready(function() { var validator = $("#Loginform").validate({ rules: { EmailId: "required", Password: { required: true, minlength: 6 } }, messages: { EmailId: "Enter your EMail ID", Password: { required: "Please Provide a password", rangelength: jQuery.format("Enter at least {0} characters") } }, // the errorPlacement has to take the table layout into account errorPlacement: function(error, element) { error.appendTo(element.parent().next()); }, // set this class to error-labels to indicate valid fields success: function(label) { // set &nbsp; as text for IE label.html("&nbsp;").addClass("checked"); } }); }); Any suggestion... Am i missing something?

    Read the article

  • InfoPath browser form submitting dirty fields changed through javascript

    - by Xavier
    I'm trying to submit an InfoPath browser form with fields that have been modified through the Spell Checker included in Sharepoint server. The spell checker checks all the fields in the page and once the user closes the SpellChecker dialog, it changes the textboxes with the new values through javascript. When I click Submit, debug the FormEvents_Submit in the form code behind and try to do a GetNodeValue("XPath to changed field"), it still shows the old values. I realize that this may be a problem of doing postbacks and I'd like to do a full page postback once the SpellChecker is done changing all the textboxes. Any suggestions would be appreciated. Thanks.

    Read the article

  • Passing javascript form variables into jQuery function not working

    - by Chase
    I am trying to pass some JavaScript variables that I have assigned to form variables into a query string used by a jQuery plug in called fancybox. If I hard code in the string that I want lightbox works great, however I need it to pass some form values in there to make it work as desire. <script type="text/javascript"> $(document).ready(function(){ var item = document.itemFinder.item; var zip = document.itemFinder.zip; var radius = document.itemFinder.radius; var dataString = "item=" + item + "&zip=" + zip + "&radius=" + radius; $("#various3").fancybox({ ajax : { type : "POST", data : dataString}, 'scrolling' : 'auto', 'overlayOpacity' : '0' } ); }); </script> What am I doing wrong?

    Read the article

  • Processing variable number of form fields

    - by a_m0d
    I am working on a form which displays information about orders. Each order has a unique id, but they are not necessarily sequential on the form. Also, the number of fields can vary (one field per row on the form). The input into the form will not be mapped straight into the database, but will be added to the current value in the database, and then saved. An example of the form is in the picture below - the callout on the right shows the id for each row. I know how to generate the form like this, but I can't work out how I can easily process each of these rows reliably. I also know how to give each of the fields a unique identifier, like name="row-23", but how can I translate that name so that I can update the related record in the database?

    Read the article

  • Sending Javascript variables.

    - by shinjuo
    I have a page that allows a user to choose some things in a form and it will calculate the weight using javascript. It breaks it up into 5 variables that I need to send to another page. Originally I was just having it put the variable into a text box and then I was posting that text box. However I dont want to have 5 text boxes. So now I need to somehow send or post the five variables to another page. Here is my javascript function. I need to post weightBoxOne - weightBoxFive js function function getWeight(){ var weightBoxOne; var weightBoxTwo; var totalWeight; var box = .5; var quantity = document.dhform.quantity.value; var cardSize = document.dhform.cardSize.value; if(cardSize == 0.0141){ if(quantity <= 1000){ weightBoxOne = (quantity * cardSize) + box; totalWeight = weightBoxOne; }else if(quantity > 1000 && quantity <= 2000){ weightBoxOne = (1000 * cardSize) + box; weightBoxTwo = ((quantity - 1000) * cardSize) + box; totalWeight = weightBoxOne + weightBoxTwo; }else if(quantity > 2000 && quantity <= 3000){ weightBoxOne = (1000 * cardSize) + box; weightBoxTwo = (1000 * cardSize) + box; weightBoxThree = ((quantity - 2000) * cardSize) + box; totalWeight = weightBoxOne + weightBoxTwo + weightBoxThree; }else if(quantity > 3000 && quantity <= 4000){ weightBoxOne = (1000 * cardSize) + box; weightBoxTwo = (1000 * cardSize) + box; weightBoxThree = (1000 * cardSize) + box; weightBoxFour = ((quantity - 3000) * cardSize) + box; totalWeight = weightBoxOne + weightBoxTwo + weightBoxThree + weightBoxFour; }else{ weightBoxOne = (1000 * cardSize) + box; weightBoxTwo = (1000 * cardSize) + box; weightBoxThree = (1000 * cardSize) + box; weightBoxFour = (1000 * cardSize) + box; weightBoxFive = ((quantity - 4000) * cardSize) + box; totalWeight = weightBoxOne + weightBoxTwo + weightBoxThree + weightBoxFour + weightBoxFive; } }else if(cardSize == 0.00949){ if(quantity <= 4000){ weightBoxOne = (quantity * cardSize) + box; totalWeight = weightBoxOne; }else{ weightBoxOne = (4000 * cardSize) + box; weightBoxTwo = ((quantity - 4000) * cardSize) + box; totalWeight = weightBoxOne + weightBoxTwo; } } document.rates.weight.value = totalWeight; } //--> this is the form that was originally posting <form action="getRates.php" name="rates" method="post" onSubmit="popupform(this, 'join')"> <table style="width: 216px"> <tr> <td style="width: 115px; height: 49px;"><span class="style16">Weight</span><br/> <input type="text" id="weight" name="weight" size="10" maxlength="4"/> </td> <td align="right" style="width: 68px; height: 49px;" valign="top"><span class="style16">Zip Code</span><br/> <input type="text" id="zip" name="zip" size="10" maxlength="5"/> </td> </tr> <tr> <td style="width: 115px"> <input name="submit" type="submit" value="Get Rate Costs" style="width: 138px" />

    Read the article

  • Rails populate edit form for non-column attributes

    - by Rabbott
    I have the following form: <% form_for(@account, :url => admin_accounts_path) do |f| %> <%= f.error_messages %> <%= render :partial => 'form', :locals => {:f => f} %> <h2>Account Details</h2> <% f.fields_for :customer do |customer_fields| %> <p> <%= customer_fields.label :company %><br /> <%= customer_fields.text_field :company %> </p> <p> <%= customer_fields.label :first_name %><br /> <%= customer_fields.text_field :first_name %> </p> <p> <%= customer_fields.label :last_name %><br /> <%= customer_fields.text_field :last_name %> </p> <p> <%= customer_fields.label :phone %><br /> <%= customer_fields.text_field :phone %> </p> <% end %> <p> <%= f.submit 'Create' %> </p> <% end %> As well as attr_accessor :customer And I have a before_create method for the account model which does not store the customer_fields, but instead uses them to submit data to an API.. The only thing I store are in the form partial.. The problem I'm running into is that when a validation error gets thrown, the page renders the new action (expected) but none of the non-column attributes within the Account Detail form will show? Any ideas as to how I can change this code around a bit to make this work me?? This same solution may be the help I need for the edit form, I have a getter for the data which it asks the API for, but without place a :value = "asdf" within each text box, it doesn't populate the fields either..

    Read the article

  • Problems using jQuery $.ajax to pass data

    - by iboeno
    I'm using ASP.NET and attempting to call a method with a signature of [WebMethod] public static string GetInfo(string id){...} using the following javascript: var elementValue = $("#element").attr('id'); var d = "{id : " + elementValue + "}"; $.ajax({ type: "POST", url: "../WebPage.aspx/GetInfo", data: d, contentType: "application/json; charset=utf-8", dataType: "json", success: function(msg) { //do this } }); And this is not working. If instead I set elementValue = 2; it works fine. If I try to hardcode in a string value for testing purposes e.g. elementValue = "nameToLookUp"; It fails. Why is this happening, and how do I resolve it? On a side not, why is type: required to be POST instead of a GET? In the end I just want to pass a string value I want to look up in a DB and retrieving some json data.

    Read the article

< Previous Page | 68 69 70 71 72 73 74 75 76 77 78 79  | Next Page >