Skip to content

Possible to specify form attribute of each input when serializing? #335

@ngoonee

Description

@ngoonee

I want to use DataTables for retail form rendering, one form per row, with different cells corresponding to different inputs.

As per http://stackoverflow.com/questions/5967564/form-inside-a-table forms are not allowed inside either <tbody> or <tr>, with the second answer indicating that setting the form attribute is a suitable workaround. However, I don't see any way to set that attribute with deform currently. It would make sense to be an argument to the serialize() function rather than being implemented per widget (just another attribute in the generated class).

For quick reference, a typical table row would look something like this (simplified)
<tr>
<td>
<form id='form1' class='form'>
<button type='submit' class='btn btn-default'>Submit</button>
</form>
<td>
<input name='input1' class='form-control' form='form1'>
</td>
<td>
<input name='input2' class='form-control' form='form1'>
</td>
</tr>

Currently I'm just calling a function which does a string replacement to insert the form='form1' line on the output of serialize, but something built-in to deform would be much preferred.

Have I missed something? Could this be added?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions