form-submit

Serializing an array in jQuery

若如初见. 提交于 2019-11-29 17:08:31
问题 How to prepare an array of element for $.ajax submit? Here images return ["val1","val2"] , but after I use $.param(images) I get the following: undefined=undefined&undefined=undefined Here is my code: $('#rem_images').click(function() { var images = new Array(); $('.images_set_image input:checked').each(function(i) { images[i] = $(this).val(); }); alert($.param(images)); return false; } Generally the idea is to check the images to delete on the page, then on a button click loop trough all

jquery submit multiple forms

别等时光非礼了梦想. 提交于 2019-11-29 16:14:55
I have 4 forms on a page. Form 1 must be submitted with either form 2,3 or 4 depending on user selection. jQuery's .submit() can only do one form. ajax posting the forms is not an option i can only think of adding the content of Form 1 to the other form as before submitting the latter form. is there any other way to do it? UPDATE: The reason for the 4 forms instead of just 1 is that I am validating each form independently, since the 2 of the 3 forms are hidden from view. If one form relies on two other forms, it sounds like they're really part of the same form, and the backend should just

why doesn't hitting enter when a SELECT is focused submit the form?

风格不统一 提交于 2019-11-29 16:08:15
问题 Consider the following HTML: <form action=""> <input /> <select> <option>A</option> <option>B</option> </select> <input type="submit" /> </form> If the focus is on the input (text box) and I hit enter, the form submits. But, if the focus is on the select (dropdown box) and I hit enter, nothing happens. I know I could figure out some JavaScript to override this, but I want to know why hitting enter doesn't just work? Is there something I would break by capturing the enter with JavaScript

Powershell: Download or Save source code for whole ie page

ⅰ亾dé卋堺 提交于 2019-11-29 15:48:47
I have this PS script it logins to a site and then it navigate's to another page. I want to save whole source for that page. but for some reason. some parts of source code is not coming across. $username = "myuser" $password = "mypass" $ie = New-Object -com InternetExplorer.Application $ie.visible=$true $ie.navigate("http://www.example.com/login.shtml") while($ie.ReadyState -ne 4) {start-sleep -m 100} $ie.document.getElementById("username").value = "$username" $ie.document.getElementById("pass").value = "$password" $ie.document.getElementById("frmLogin").submit() start-sleep 5 $ie.navigate(

jQuery not posting all inputs of a form after the .append()

时光毁灭记忆、已成空白 提交于 2019-11-29 13:43:18
I have a form generated dynamically with the method .append() of jQuery. I can add any number of new input, textbox, cmbbox, etc... But the problem is that when I do the sumbit of the form, the PHP target does not receive the new input added, but just the vars connected to the input already in the form before the append(). Any ideas? The javascript: $("#button").live('click',function add(){ $("#list").append( '<li style="height:20px;">' +'<input type="text" class="text" id="prova" name="prova[]" value="prova">'+ '</li>' ); }); The Html: <input type="submit" id="button" value="Add input"> <form

How to show a loading gif mean while a submit form is being executed JQuery

柔情痞子 提交于 2019-11-29 13:22:20
问题 I'm trying to show a simple spinner gif meanwhile a submit is being executed (it takes a bit because I have to establish some communications with providers via web services). So, I have this: $('#gds_form').submit(function() { var pass = true; //some validations if(pass == false){ return false; } $("body").prepend('<div class="ui-widget-overlay" style="z-index: 1001;"></div>'); $("body").prepend("<div id ='PleaseWait'><img src='/images/spinner.gif'/></div>"); return true; }); the thing is,

Jquery: return: false on submit not working - form still submits

梦想的初衷 提交于 2019-11-29 12:55:32
Is there a reason that the form is still submitting? The validation checks work but if it everything is input correctly, the form submits and the ajax request does not fire. $("#formRegister").submit(function () { // Start problem var mode = $("registerMode").val(); // End problem var username = $("#registerUsername").val(); var password = $("#registerPassword").val(); var passwordConfirm = $("#registerPasswordConfirm").val(); var avatar = $("#registerAvatar").val(); if (username == 'Username') { $("#registerError").html('You must enter a username'); } else if (password == 'Password') { $("

What to do with php after jquery .serialize()

假装没事ソ 提交于 2019-11-29 11:47:16
Ok somehow im having the hardest time figuring this out so i want to do an call ajax with a form and im using jquery to serialize it with .serialize(). The data being sent to php looks something like this key1=value&key2=value2&key3=value3 And im using a post request. It looks simple enough, but somehow im having a really hard time figuring out how to access these key/value pairs, i cant use explode() on & because that will give me [0] => key1=value1 [1] => key2=value2 [2] => key3=value3 and i cant use $_POST['key1'] or $_GET['key1'] in php to access these values. What should i do!!! Thanks

Using jquery to prevent resubmitting form

筅森魡賤 提交于 2019-11-29 10:59:05
I use jquery's .submit() to intercept user's submit event, however I found a problem. When the user single click the submit button, the form is submitted normally, but if a user deliberately fast click it multiple times, it will submit multiple times, which will cause duplicated data in the database. What's the solution for this kind of problem ? Update: Well, I see some of the advice said disabling the submit button. This should prevent the form being submitted multiple times, but the problem is the form element in my page isn't refreshed, if I disable it the user won't be able to submit it

jQuery: submit form after a value is selected from dropdown

天涯浪子 提交于 2019-11-29 10:56:04
问题 I have this form in my HTML: <form action="/awe/ChangeTheme/Change" method="post"> <select id="themes" name="themes"> ... <option value="blitzer">blitzer</option> </select> <input type="submit" value="change" /> </form> Anybody knows how to submit it when a value is selected in the 'themes' dropdown? 回答1: The other solutions will submit all forms on the page, if there should be any. Better would be: $(function() { $('#themes').change(function() { this.form.submit(); }); }); 回答2: In case your