b95f4a96b8bc9be737c0ba89e0418e125967221a tdreszer Thu Sep 2 13:18:50 2010 -0700 Added two useful functions for overriding forms with ajax diff --git src/hg/js/utils.js src/hg/js/utils.js index 20ee75a..21f3872 100644 --- src/hg/js/utils.js +++ src/hg/js/utils.js @@ -522,6 +522,18 @@ return urlData; } +function setIdRemoveName(obj) +{ // This function removes the name of an obj and sets it as the id. This is very useful + // to override forms submitting named inputs and instead setCartVarFromObjId() can be used selectively + var id = $(obj).attr('name'); + if(id != undefined) { + $(obj).attr('id',id); + $(obj).removeAttr('name'); + } + //warn($(obj).attr('id')+'='+$(obj).val()+" name:"+$(obj).attr('name')); +} + + function varHashChanges(newVars,oldVars) { // Returns a hash of all vars that are changed between old and new hash. New vars not found in old are changed.