Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: ish/formish
base: 826e24603d
...
head fork: ish/formish
compare: ffa5cc498b
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Showing with 13 additions and 8 deletions.
  1. +13 −8 formish/js/formish.js
View
21 formish/js/formish.js
@@ -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,23 +126,28 @@ 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) {
- var formid = o.attr('id');
// Get the encoded template
var code = t.next('.adder').val();
// Find out how many fields we already have
var l = count_previous_fields(t.next('.adder'));
- // Get some variable to help with replacing (originalname, originalid, name, id)
+ // Get some variable to help with replacing (originalname, id)
var originalname = t.next('.adder').attr('name');
- var new_originalname = t.closest('.type-container').attr('id');
- new_originalname = new_originalname.substr(0,new_originalname.length-6);
- new_originalname = convert_id_to_name(new_originalname,formid);
var segments = originalname.split('.');
// Get the numbers used in the originalname
var seqnums = get_sequence_numbers(segments, l);
- var originalid = $(o).attr('id')+'-'+segments.join('-');
segments[ segments.length -1 ] = l;
- var name = segments.join('.');
var id = $(o).attr('id')+'-'+segments.join('-');
// Decode the template.
var html = decodeURIComponent(code);

No commit comments for this range

Something went wrong with that request. Please try again.