Permalink
Browse files

Fix form with no id attribute but a form element with name="id".

  • Loading branch information...
1 parent e968391 commit ffa5cc498b47f2c146a6aee538307f5e2adf61ab @atomatt atomatt committed Mar 31, 2011
Showing with 12 additions and 1 deletion.
  1. +12 −1 formish/js/formish.js
View
@@ -78,7 +78,7 @@ function renumber_sequences(o) {
}
function renumber_sequence(o) {
- var formid = $(o).attr('id');
+ var formid = formish_form_id(o);
var N = {};
o.find('.type-sequence.widget-sequencedefault').each( function () {
field_id = $(this).attr('id');
@@ -126,6 +126,17 @@ function renumber_sequence(o) {
}
+/*
+ * Find the form element's id attribute.
+ */
+function formish_form_id(form) {
+ var formid = $(form).attr('id');
+ if (typeof(formid) != typeof('')) {
+ formid = ''
+ }
+ return formid;
+}
+
function add_new_item(t,o) {
// Get the encoded template
var code = t.next('.adder').val();

0 comments on commit ffa5cc4

Please sign in to comment.