jquery - Exclude widget's input fields from being submitted in parent form -


I've created a widget using & lt; Input & gt; elements are added by this required by this widget can be initialized within a form element, which can result in depositing fields added to the parent form submission.

I do not want to specify the specified input, and it should be done inside the widget because it is the same as the input elements Knowing about

Re-enable this idea before submitting the form

form format before, and afterwards.

It is important to disturb the code outside the widget

Unfortunately , During the _create widget, it. Element has not been added to DOM , so there is no way to add the handler to the submission event of the form.

Sample code:

  $ (function () {$ .widget ("Foo.Widget", {_create: function} (this.element.append ($ ( "Input type = 'radio' & gt;"). Attr ("name", "the input")); // Force the submission of the included form var form = this.elemeng.closest ( "Form"); // Return $ ()};});});  

It is possible to pair later, but for this, the user has somehow to interact with the widget Will be required, which is not mandatory.

I can add a timer and do it Bind it, because the user will not submit it during the second second (bad solution).

In addition, I can either pass reference to the widget or parent form < / Code> Option but this is something I want to avoid.


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -