- Posts: 42
- Thank you received: 4
Ask the community, share ideas, and connect with other LimeSurvey users!
/************************************************************/ function handleKeyPress (currval, currname, currtype){ /************************************************************ /* Custom validation /************************************************************/ if($('token2').length > 0) { validateToken2(); } /************************************************************ /* Call default behavior /************************************************************/ checkconditions(currval, currname, currtype); } $(document).ready(function(){ /************************************************************ /* Remove checkconditions for ALL text box controls /************************************************************/ $("input.text ").each(function(){ $(this).remove('onkeyup'); }); /************************************************************ /* add in an event for the text box keyup /************************************************************/ $('.text ').keyup(function(){ var currval = $(this).attr('value'); var currname = $(this).attr('name'); var currtype = $(this).attr('type'); handleKeyPress(currval,currname,currtype); }); });
/************************************************************/ function handleKeyPress (ctrl, e){ // Inserted Tag Actions var currval = $(ctrl).attr('value'); var currname = $(ctrl).attr('name'); var currtype = $(ctrl).attr('type'); var needtocheck = e==="onkeyup"; // we only override "onkeyup" events // validate Lime Id if($('idcheck').length > 0) { validateToken2(); needtocheck = true; } if ( needtocheck ) { checkconditions(currval, currname, currtype, e); // invoke default text box checkconditions } } /************************************************************/ $(document).ready(function(){ /************************************************************ EVENTS /************************************************************/ $('.text ').keyup(function(){ handleKeyPress(this,'onkeyup'); }); });