php - jQuery dynamically added form element data not sent to database when user is on intranet -


I have an interesting problem that I have created a farm to make races for runners. The form allows the user to add more than one runner and sign them all at a time. Extra runner functionality is programmed using jQuery.

Here is jQuery which adds extra runner ...

  & lt; Script type = "text / javascript" & gt; Var current = 1; Clone (true) .removeAttr ("id"). $ (Document) .ready (function () {$ ("# addrunner") click (function () {current ++; $ newrunner = $ ("# runnerTemplate"). Each (function (i) {var $ currentElem $ $ (This); $ currentElem ("id", "fieldSet" + current), beforehand the Internet ("# runner template"); $ newrunner.find ("input") .prop ("name", $ currentElem .prop ("name") + current, $ currentElem.prop ("id", $ currentElem.prop ("id") + current);}) $ newrunner.find ("$ CurrentElem.prop (" name " $ CurrentElem.prop ("name") + current); $ currentElem.prop ("id", $ CurrentElem.prop ("id") + current);}); var f = $ ("# fieldSet" + current ); F.html (f.html). Replace ("fieldSetID", "fieldSet" + $ Newrunner.appendTo ("#of ("Value"); $ ("# count") .prop ("value", prevailing + This form is a basic HTML form.  

This form works. Works as long as the user is not on intranet. If the user is on intranet, the form will only submit the first runner; All data in an additional runner that is added through jQuery is not transferred on submission. This is what makes me confused working at home here, it works perfectly without a problem. But, a customer who uses it from his office on Intranet, the first runner works, but does not add additional runners.

Any help will be welcomed thanks.

Some browsers have special security on DOM objects, you need to convert objects to HTML Then it is better to replace the id / name, you use a hidden template in your field, follow the functional code below:

Finding unique IDs and getting it on the backend Easy group of data for

Ri> & lt; Script type = "text / javascript" charset = "UTF-8" & gt; ('Click', function () {// div # runner_build var clone_build = $ ('#' + $ (this) .attr ('clone_nested') + '_build'); // div # runner_clone var clone_holder = $ ('#' + $ (This) .attr ('clone_nested') + '_clone'); var clone_object = $ ('.nested_fields: first', $ (clone_bild)) .clone (); $ (clone_object) .html ($ (Clone_object) .html (). Replace (/ clone_key / g, (new date). GetTime ()) ($ (Clone_object); $ (clone_object) .find ('input [name * =' _ ']'). Val () ;end (); $ (clone_placeholder) before ($ (clone_object)); $ (Clone_object) .slideDown ();});}); & Lt; / Script & gt; & Lt; Div & gt; & Lt; Div id = "runner_build" & gt; & Lt; Div class = "nested_fields" & gt; & Lt; Input type = "text" name = "runner [clone_key] [name]" value = "" id = "runner_clone_key_name" & gt; & Lt; Input type = "text" name = "runner [clone_key] [address]" value = "" id = "runner_clone_key_race" & gt; & Lt; Input type = "text" name = "runner [clone_key] [phone]" value = "" id = "runner_clone_keyfone" & gt; & Lt; Input type = "hidden" name = "runner [clone_key] [_deleted]" value = "true" id = "runner_clone_key_hair" & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; Div id = "runner_clone" & gt; & Lt; / Div & gt; & Lt; A href = "javascript: zero (0)" clone_nested = "runner" & gt; Add Runner & lt; / A & gt; & Lt; / Div & gt; & Lt ;? Php unset ($ _ request ['runner'] ['clone_key']); Foreign exchange ($ _ request ['runner'] as runner) {if ($ runner ['_'] == true) {continue; }}? & Gt;

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -