Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Why this validation does not work: Visual Form Builder usage Re: Why this validation does not work: Visual Form Builder usage

#99266
Vermaas
Participant

@xpy: you were right =D I’ve modified it to this:


$(function() {
/*
Adding an extra fieldset
*/
// The variables
var link = '
  • Voeg nog een huisdier toe.
';
var fieldset = $('.uw-huisdier');

// Add the link to the fieldset
$(link).appendTo(fieldset);

// Add a fieldset
$('.add-field').click(function() {
// Count the clones
var num = $('.fieldset').length;
var newnum = new Number( num + 1);

// Copy the above fieldset and transfer it after the first on
var newElem = $(fieldset).clone();

// Find, remove and rename
$(newElem).find('#add-extra').remove();
var inputField = $(newElem).find('input');

$(inputField).each(function() {
var randstring = (Math.floor((Math.random() * 100)) % 94) + 33;

$(this).removeAttr('id').attr('id', 'newelement-' + randstring);
$(this).removeAttr('name').attr('name', 'newname-' + randstring);
});

// Insert the new modified row
$(newElem).insertAfter(fieldset);

// Make sure the link will die
return false;
});
});

and it seems to work :)! Well the form validation works, but not the email :( It seems that the plugin uses the database to see which field has to be send by email..

I might modify the plugin for this part…