maxatwork / form2js

Javascript library for collecting form data
http://maxatwork.github.com/form2js/
MIT License
640 stars 137 forks source link

Ability to exclude a node in nodeCallback #67

Open birarda opened 10 years ago

birarda commented 10 years ago

Is there any way for me to force the exclusion of a node in my nodeCallback?

I have an attribute I'm setting on inputs when they change, and I can check for this in the nodeCallback, but I can't find anything to return that doesn't end up just adding unchanged elements to the object.

function cleanupFormValues(node) {  
  if (node.getAttribute && node.getAttribute('data-changed') === 'true') {
    if (node.type && node.type === 'checkbox') {
      return { name: node.id, value: node.checked ? true : false };
    } else {
      return false;
    }
  } else {
    return { name: '', value: null };
  }
}
birarda commented 10 years ago

For now I am hacking around this by setting the values I do not want included to disabled before calling form2js