volosoft / jtable

A JQuery plugin to create AJAX based CRUD tables.
http://www.jtable.org
1.1k stars 506 forks source link

Hidden field does not get value from definition #1635

Open tmandys opened 9 years ago

tmandys commented 9 years ago

I try to cope with know problem when checkbox does not send any value when unchecked which leads to database error because of non-null constraint. The fix is e.g. http://stackoverflow.com/questions/1809494/post-the-checkboxes-that-are-unchecked, i.e. adding hidden field which take places when checkbox value is missing in POST data.

But jtable ignores value for edit dialogs because feeds from record. Unless you have better checkbox workaround I believe hidden value should be assignable. My proposed fix in <_showEditForm: function ($tableRow).>

if (field.type == 'hidden') {
-  $editForm.append(self._createInputForHidden(fieldName, fieldValue));
+  $editForm.append(self._createInputForHidden(fieldName, fieldValue == undefined?field.defaultValue:fieldValue));
  continue;
}
stiz1981 commented 9 years ago

cool !! work info 146%, good !