- Posts: 37
- Thank you received: 4
Ask the community, share ideas, and connect with other LimeSurvey users!
<script type="text/javascript" charset="utf-8"> $(document).ready( function() { var my_surveyId='{SID}'; var my_groupId='{self.gid}'; var my_quesitonId='{self.qid}'; var my_self='{self.sgqa}'; // Operate for its appearance only (but have no effect to modify its intrinsic value): Display as UpperCase $('#answer{self.sgqa}').css('text-transform', 'uppercase'); $('#answer{self.sgqa}').blur(function(){ // Operate for its intrinsic value: Trim + Transform to Uppercase $(this).val( $.trim( $(this).val().toUpperCase() ) ); }); }); </script>
<script type="text/javascript" charset="utf-8"> $(document).ready( function() { var my_surveyId='{SID}'; var my_groupId='{self.gid}'; var my_quesitonId='{self.qid}'; var my_self='{self.SGQA}'; // Operate for its appearance only (but have no effect to modify its intrinsic value): Display as UpperCase $('#answer{self.SGQA}').css('text-transform', 'uppercase'); $('#answer{self.SGQA}').blur(function(){ // Operate for its intrinsic value: Trim + Transform to Uppercase $(this).val( $.trim( $(this).val().toUpperCase() ) ); }); }); </script>
Thanks for the tip, if you can put in in our manual please : www.limesurvey.org/manual/Workarounds:_M...ime_using_Javascriptkmanapp wrote: Just realise that I wrongly post this thread in "Instlalation & Update issues" forum, I have made a correct one in the "Can I do this with LimeSurvey" forum and has this URL:
www.limesurvey.org/en/forum/can-i-do-thi...ppercase-onblur-trim
I think you don't save www.limesurvey.org/manual/index.php?titl...cript&action=historykmanapp wrote: Great, briefly added here, kindly please feel free to revise:
Text Input (e.g. "short free text", "huge free text"): Force UpperCase + onBlur Trim
www.limesurvey.org/manual/index.php?titl...Case_.2B_onBlur_Trim
<script type="text/javascript" charset="utf-8"> $(document).ready( function() { var this_surveyId='{SID}'; var this_groupId='{self.gid}'; var this_quesitonId='{self.qid}'; var this_self='{self.sgqa}'; $('#answer{self.sgqa}').blur(function(){ $(this).val( $.trim( $(this).val() ) ); }); }); </script>
<script type="text/javascript" charset="utf-8"> $(document).ready( function() { var this_surveyId='{SID}'; var this_groupId='{self.gid}'; var this_quesitonId='{self.qid}'; var this_self='{self.sgqa}text'; $('#answer{self.sgqa}text').blur(function(){ $(this).val( $.trim( $(this).val() ) ); }); }); </script>
$(document).on('blur',"#question{QID} input:text,#question{QID} textarea",function(){ $(this).val( $.trim( $(this).val() ) ); });