Reset input values from GET url params using jQuery -
This may sound strange, but I want to be able to fill a static web form with a GAT Ultimate List.
Say that I have a page, 'self.html':
form action = "self.html" method = "receive" accept -charset = " Utf-8 "& gt; & Lt; Label = "40" & gt; new query? & Lt; / Label & gt; & Lt; Input type = "radio" name = "40" id = "40" value = "yes" & gt; Yes and amp; Nbsp; & Lt; Input type = "radio" name = "40" id = "40" value = "no" & gt; = & Lt; Label = "41" & gt; What is your favorite color? & Lt; / Label & gt; & Lt; Input type = "text" name = "43" value = "" id = "41" & gt; & Lt; / Form & gt;
Whenever there is an input change, I need a form to submit myself:
$ (document) .ready (function ( ) {$ ('Input') .change (function () {$ ("form: first"). Submit ();}); // collate_results ();});
But obviously I want to be sure, so that they do not reset on reload.
(Why? Because I'm doing it in a filemaker's web view, and the only way to draw data from a form is to get the source - url - and it's parsing ... To reflect the current situation, url is required to be updated, and it may also be able to pass on any new record data I want to display ...)
Update Do:
here Era is non-functioning code - it is a fine value area, but fails to radio button ..
$ ( 'input'). Change (function () {$ ("form: first"). Submit ();}); Var qString = jQuery.url.attr ("query"); If (beststring) {qString = qString.split ("& amp;"); $ (Qstring) .each (function () {var parts = this.split ("="); var item = $ ('#' + parts [0]); if ($ (item) .attr ('type' ($ ('$') [$ ('#' + Parts [0]). Val (part [1]);} if ($ (item) .attr ('type') == 'radio') { $ (Item) .each (function () {console.log (this); if ($ (this) .val () == parts [1]) {$ (this) .attr ('checked', 'checked' );} And {$ (this) .attr ('check', '');}}}}}}}}}});
The problem is that I yes, no, there are several radio buttons with the value of na, thus, the way jQuery wants to do this can not be implemented, if it helps, then I will again use the radio button. I can do it from ...
& amp; lt; form action = "self.html" method = "get" accept-charset = "utf-8" & gt; & lt ; Label = "40" & gt; new question? & Lt; / label & gt; & lt; input type = "radio" name = "47" id = "47_yes" value = "yes" & gt; yes & amp; ; & Nbsp; & lt; input type = "radio" name = "47" id = "47_no" value = "no" checked & gt; = label = "48"> what is your favorite color ? & Lt; / Label & gt; & Lt; Input type = "text" name = "48" value = "" id = "48" & gt; & Lt; / Form & gt;
A better way to apply AJAX may be to submit input changes every time
To read the GET parameter, you can use this plugin for jQuery.
Comments
Post a Comment