Results 1 to 1 of 1

Thread: Function triggering before I select a date in datepicker

  1. #1
    Join Date
    Oct 2011
    Posts
    46
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Function triggering before I select a date in datepicker

    Hello,

    I really need the help of the experts on here.

    When I call the function v9_insert_comments('1') the alert(sdate) triggers before I even get to select a date in the datepicker.

    My goal is to have the v9_insert_comments() check to see if the sdate is null or not. If its null then just { return } if not { do something else }.

    The current case if that sdate is always null because the datepicker never gets a chance to set it.

    Code:
    var sdate 
     
    //======================================================================== 
      function v9_insert_comments(x) { 
    //======================================================================== 
     
        if (x == 1) { 
                select_date() 
                alert(sdate) 
        } 
     
     
    }//end of function 
     
     
    //======================================================================== 
      function select_date() { 
    //======================================================================== 
        $('#dd').dialog({ 
            autoOpen: true, 
            modal: true, 
            overlay: { 
                opacity: 0.5, 
                background: 'black' 
            }, 
            title: "title", 
            height: 265, 
            width: 235, 
            draggable: false, 
            resizable: false 
     
        }); //end of dialog 
     
        $('#d1').datepicker({ 
            onSelect: function() { 
                sdate = $(this).val(); 
                $("#dd").dialog("close"); 
     
            } 
        }); 
     
    } //end of function
    Last edited by jscheuer1; 09-01-2012 at 02:37 PM. Reason: Format

Similar Threads

  1. php date(1) function
    By autofocus in forum PHP
    Replies: 1
    Last Post: 11-24-2009, 06:50 AM
  2. select between date and time
    By tirso in forum MySQL and other databases
    Replies: 1
    Last Post: 03-02-2009, 05:53 PM
  3. Date HTML Select Boxes functions
    By JasonDFR in forum PHP
    Replies: 0
    Last Post: 02-07-2009, 06:40 PM
  4. how to display only tuesday date using date function
    By meenakshi in forum JavaScript
    Replies: 15
    Last Post: 06-01-2008, 11:16 PM
  5. the date function for GMT?
    By Dennis_Gull in forum PHP
    Replies: 2
    Last Post: 04-21-2007, 11:08 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •