- Posts: 26
- Thank you received: 1
Ask the community, share ideas, and connect with other LimeSurvey users!
<script src="https://cdn.jsdelivr.net/npm/md5-js-tools@1.0.2/lib/md5.min.js"></script> <script type="text/javascript" charset="utf-8"> $(document).ready(function() { alert ("test"); var dob = {DateOfBirth.NAOK}; alert (dob); var mob = {MobNo.NAOK}; alert (mob); var s = dob + mob; alert (s); var hash = MD5.generate(s); alert (hash); var thisQuestion = $('#question{QID}'); thisQuestion.val = hash; }); </script>
Please Log in to join the conversation.
Please Log in to join the conversation.
<script src="https://raw.githubusercontent.com/blueimp/JavaScript-MD5/master/js/md5.min.js"></script><script type="text/javascript" charset="utf-8"> $(document).ready(function() { alert ("test"); var dob = {date('dmY',strtotime(DateOfBirth.NAOK))}; alert (dob); var mob = {MobNo.NAOK}; alert (mob); var s = dob * mob; var ss = s.toString(); var smob = mob.toString(); var sss = ss + '_' + smob; alert (sss); var hash2 = md5('value'); alert (hash2); var hash = md5(sss); alert (hash); $('input[type=text]', thisQuestion).val(hash); }); </script>
Please Log in to join the conversation.
Any ideas why might be stopping the inclusion of the external libraries, please?
In other news, is it possible to not save the variables passed in the previous question group, please?
Please Log in to join the conversation.
Please Log in to join the conversation.
<script src="/lime3/upload/surveys/{SID}/files/md5.js"></script> <script type="text/javascript" charset="utf-8"> $(document).ready(function() { var dob = {date('dmY',strtotime(DateOfBirth.NAOK))}; var mob = {MobNo.NAOK}; var sss = dob * mob + '_' + mob; var hash = md5(sss); var thisQuestion = $('#question{QID}'); $('input[type=text]', thisQuestion).val(hash); }); </script>
<script src="https://raw.githubusercontent.com/blueimp/JavaScript-MD5/master/js/md5.js"></script>
Please Log in to join the conversation.
Please Log in to join the conversation.
Step 2 is not "hiding the variables". It is overwriting them.holch, so to make sure I'm understanding you:
question group 1: get the variables which I'll hash
question group 2:
- 2 variables:
1) text & hidden: do the javascript magic (as above)
2) equation & hidden: hide the variables in qs group 1.
correct?
re: external scripts, nothing that I'm aware of. Is there an easy way I can test if the library is being imported, please? and I don't believe I have any syntax errors in my code, right?
DateOfBirth="erased" MobNo="erased"
Please Log in to join the conversation.