Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Obfuscated Javascript?
Message
From
15/02/2013 15:07:59
 
 
To
15/02/2013 14:55:41
General information
Forum:
Javascript
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01566169
Message ID:
01566178
Views:
57
Thanks.

No, just getting started with JavaScript. Quite a few sources seem to recommend jQuery as a good Javascript framework.

>It sets the value of EntryCode to AccessCode + a formatted date from the date picker + "00000" + a slice of the check number. slice is documented at http://api.jquery.com/slice/
>
>Are you familiar with jQuery?
>
>>Here's some code from a page that gets and validates 3 variables - numeric Access Code and Cheque Number, and a date chosen from a date picker. I think I follow most of the code; the lower part first checks that the values are not blank. If they are not, it then runs a line of code I don't understand, then returns true.
>>
>>What does that line do? ( the one that ends in .slice(-5) )
>>
>>
>><script type="text/javascript">
>>    $(document).ready(function () {
>>        $("#ChequeNumber").numeric({ decimal: false, negative: false });
>>        $("#AccessCode").numeric({ decimal: false, negative: false });
>>    });
>>
>>    $('#datePicker').bind('datebox', function (e, passed) {
>>        if (passed.method === 'close') {
>>            $('#VisitDate').val($('#datePicker').data('datebox')._formatter('%m/%d/%Y', $('#datePicker').data('datebox').theDate));
>>        }
>>    });
>>
>>    $(document.forms[0]).submit(function () {
>>        if ($("#ChequeNumber").val() == "") {
>>            $(".error").html("Cheque # is not a recognized number.");
>>            $("#ChequeNumber").focus();
>>            return false;
>>        } else if ($("#VisitDate").val() == "") {
>>            $(".error").html("Please enter your date of visit and try again.");
>>            $("#VisitDate").focus();
>>            return false;
>>        } else if ($("#AccessCode").val() == "") {
>>            $(".error").html("Access code is not a recognized number.");
>>            $("#AccessCode").focus();
>>            return false;
>>        }
>>        else {
>>            $("#EntryCode").val($("#AccessCode").val() + $('#datePicker').data('datebox')._formatter('%m%d%Y', $('#datePicker').data('datebox').theDate) + ("00000" + $("#ChequeNumber").val()).slice(-5));
>>
>>            return true;
>>        }
>>    });
>></script>
>>
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform