« first day (17 days earlier)      last day (190 days later) » 

09:05
What would be the idiomatic JS solution for comparing one string with multiple values? In C++, I'd map them to constant numbers and put those in a switch.
 
10 hours later…
19:00
anyone here?
@IsmaelMiguel you busy?
> var dateOfBirth = new Date($(this).val);
do I need () after .val?
Yes, all functions require. But instead of doing that bottleneck, try this.value
like this
> var dateOfBirth = new Date(this.value);
Yup
That should work
thank you, now I am having other issues.....let me take a look....lol
Which ones?
19:11
$("#<%=txtDate.ClientID %>").blur(function () {
    var dateOfBirth = new Date(this.value);
    var currentDate = new Date();
    minAge = new Date(currentDate.getFullYear() - 18, currentDate.getMonth(), currentDate.getDay());
    if (dateOfBirth > minAge) {
        $("#dialog-DOB").dialog("open");
        return false;
    }
    return false;
})
I have this in my $(document).ready(function(){ but it won't run when focus is lost from the txt box
sorry it does run
but the popup doesn't work
Try running $("#dialog-DOB") on your console
19:30
it returns the HTML for the popup/dialog in the console
Then your if (dateOfBirth > minAge) { isn't working
I can step through that code. the dialog isn't popping up
Do you have the right classes and attributes?
I found it, I was missing a Hash
#
19:49
$("#dialog-DOB").dialog({
Can you show me the div?
I have fixed almost all the issues except for this date issue
var currentDate = new Date();
minAge = new Date(currentDate.getFullYear() - 18, currentDate.getMonth(), currentDate.getDay());
it returns
> Wed Jul 02 1997 00:00:00 GMT-0500 (Central Daylight Time)
<div id="dialog-DOB" title="You cannot search for a minor">
<p>
<span class="ui-icon ui-icon-alert" style="float: left; margin: 0 7px 20px 0;"></span>
You cannot perform a record search for a minor, please change the Date of Birth.
</p>
</div>
And that $("#dialog-DOB").dialog({ wasn't working?
About the date...
You should try to use currentDate.setFullYear(currentDate.getFullYear()-18)
var currentDate = new Date();
currentDate.getFullYear(currentDate.getFullYear() - 18);
console.log(currentDate);
It works perfectly
Or not...
Dang
I saw the bug
var currentDate = new Date();
currentDate.setFullYear(currentDate.getFullYear() - 18);
console.log(currentDate);
@Malachi It works!!!
20:12
@IsmaelMiguel it was because I had it like this $("dialog-DOB").dialog({
    $("#dialog-DOB").dialog("open");
    return false;
I had forgotten the "#"
You didnt...
At least not on that code
I got it working, now I just need to clear the text box after the alert. then I think I might post some code? not sure yet though
I might have more stuff to go in here
Try posting it after
20:26
I am trying to clear out the text box when the dialog box is closed, but I think the jQuery Mask is messing with me, it won't clear the box
I don't know Javascript very well do I ?
$("#dialog-DOB").dialog({
    autoOpen: false,
    resizable: false,
    height: 'auto',
    width: '400px',
    modal: true,
    show: { effect: "drop", direction: "down" },
    hide: { effect: "drop", direction: "up" },
    buttons: {
        "Okay": function () {
            $("#<%=txtDate.ClientID %>").value = "";
            $(this).dialog("close");
        }
    }
.value doesn't exist
the box wouldn't close with .val()
oh I got it now
$("#<%=txtDate.ClientID %>").value = ""; --> $("#<%=txtDate.ClientID %>").val("");
@IsmaelMiguel that is exactly what I did! thanks
lol
You're welcome
Sometimes, people tend to use .text
20:47
0
Q: Don't search for minors, it isn't allowed

MalachiI have a search form that doesn't require much in terms of input parameters, but the Date Of Birth is import for this particular search. I have been working on creating a way that the form can be intuitive and keep people from attempting to search for a minor, we won't give you any search result...

now I have to work on getting results from the query
I can't help you with that, I don't do ASP
21:39
@Malachi I made a review on it. Hope it meets what you were looking for. I had to stop there because it was getting too extensive.
#2, what do you mean?
I am not seeing exactly what you are talking about. only the strings need quotes on some of those properties
Yes, but you are very inconsistent.
Check the Okay
That one doesn't require quotes, but you put anyway
But why not on all the others?
some of the stuff you are saying I see, but some of it I don't follow
Ask about it
let me go through the list, I haven't finished reading the answer yet
21:45
Pretty lengthy, I know
#7 -- I have on handler on a button and another on a text box
 $("#<%=txtDate.ClientID %>").blur(function () {
 $("#<%=btnSearch.ClientID %>").click
Crap
Let me patch it
didn't notice that
But that line won't change much
I like the defaults variable, I didn't even know I could do that. that is cool
21:52
You can, and it is really helpful
I've patched the answer
what is this? $.extend({}, ?
$.extend is used to extend an object, the 1st parameter
When you don't want to extend anything, you simply pass it an empty object (that is the {})
But $.extend also returns a copy of the extended object, so, you can just pass it straight to the functions and not worry about it
I will have to finish changes on this tomorrow. thank you!
I am not sure what you mean with #4
You are using $("#<%=txtDate.ClientID%>") everywhere
You could use something like var $txtdate = $("#<%=txtDate.ClientID%>")
Or you can chain the methods like $("#<%=txtDate.ClientID%>").something().modal().datepicker() (just an example)
22:09
I will take a look at that. I don't know that I can chain them though. but the variable I like
anyway, TTGH
Alright dude, take your time

« first day (17 days earlier)      last day (190 days later) »