How do I check for null date entires using custom JScript on a SharePoint NewForm.aspx?

Hi,
I have the below JScript:
/*Function to convert the US Date format to UK date format */
function parseDate(input) {
var parts = input.split('/');
// new Date(year, month [, date [, hours[, minutes[, seconds[, ms]]]]])
return new Date(parts[2], parts[1]-1, parts[0]); // months are 0-based
/*Function to check if end date is before the start date */
function checkDates(){
var sd = parseDate($("input[title='From']").val());
var ed = parseDate($("input[title='Until']").val());
if(sd > ed) {
alert("Please check From and Until Date");
$("input[value$='Save']").attr('disabled', true); //hide save button
else
$("input[value$='Save']").attr('disabled', false); //show save button
The above works fine for checking sd > ed but I can't seem to check for null's, I have attempted the below which doesn't work:
/*Function to convert the US Date format to UK date format */
function parseDate(input) {
var parts = input.split('/');
// new Date(year, month [, date [, hours[, minutes[, seconds[, ms]]]]])
return new Date(parts[2], parts[1]-1, parts[0]); // months are 0-based
/*Function to check if end date is before the start date */
function checkDates(){
var sd = parseDate($("input[title='From']").val());
var ed = parseDate($("input[title='Until']").val());
if( (sd > ed) || (sd == null) || (ed == Null) ) {
alert("Please check From and Until Date");
$("input[value$='Save']").attr('disabled', true); //hide save button
else
$("input[value$='Save']").attr('disabled', false); //show save button
Any help appreciated.

Hi aspnet-scotland,
Please post ASP.NET related questions in
ASP.NET forums where you could receive better responses.
Thanks for your understanding.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • How does APEX check for null values in Text Fields on the forms?

    Hello all,
    How does APEX check for null values in Text Fields on the forms? This might sound trivial but I have a problem with a PL/SQL Validation that I have written.
    I have one select list (P108_CLUSTER_ID) and one Text field (P108_PRIVATE_IP). I made P108_CLUSTER_ID to return null value when nothing is selected and assumed P108_PRIVATE_IP to return null value too when nothign is entered in the text field.
    All that I need is to validate if P108_PRIVATE_IP is entered when a P108_CLUSTER_ID is selected. i.e it is mandatory to enter Private IP when a cluster is seelcted and following is my Pl/SQL code
    Declare
    v_valid boolean;
    Begin
    IF :P108_CLUSTER_ID is NULL and :P108_PRIVATE_IP is NULL THEN
    v_valid := TRUE;
    ELSIF :P108_CLUSTER_ID is NOT NULL and :P108_PRIVATE_IP is NOT NULL THEN
    v_valid := TRUE;
    ELSIF :P108_CLUSTER_ID is NOT NULL and :P108_PRIVATE_IP is NULL THEN
    v_valid := FALSE;
    ELSIF :P108_CLUSTER_ID is NULL and :P108_PRIVATE_IP is NOT NULL THEN
    v_valid := FALSE;
    END IF;
    return v_valid;
    END;
    My problem is it is returning FALSE for all the cases.It works fine in SQL Command though..When I tried to Debug and use Firebug, I found that Text fields are not stored a null by default but as empty strings "" . Now I tried modifying my PL/SQL to check Private_IP against an empty string. But doesn't help. Can someone please tell me how I need to proceed.
    Thanks

    See SQL report for LIKE SEARCH I have just explained how Select list return value works..
    Cheers,
    Hari

  • Can I exit from paintComponent?  ...or... how can I check for invalid data?

    I'm writing a calendar applet for a programming class and I've nearly completed it but I'm stuck at checking for valid data.
    What seems to be happening is that paintComponent() is being called before actionPerformed.
    In actionPerformed (when they click the button), it checks to make sure they entered a valid month (1 to 12). If the didn't it dispalys a message, but if they did it calls repaint().
    But even if repaint() isn't called, Java still seems to call it before actionPerformed and I get exceptions.
    So I tried checking inside of paintComponent() by using a simple if(...) return; but that doesn't seem to do anything... it just keeps going through with the method.
    So -- Once the user presses my button I want to make sure the data is valid before repainting the screen. How can I do this?

    I validate it in actionPerformed which is called by
    the action listener... that is what you meant right?
    The problem is that it seems paintComponent() is being
    called before I can validate the data with
    actionPerformed(). I need to stop paintComponent()
    from always being calledMVC. (Model, View, Controller)
    Initially the internal value of the data (the model) should be valid (or null with a check in the paintComponent method)
    paintComponent (the view part) shows the state of the valid data.
    You press the button.
    actionPerformed is called (the controller).
    It checks the value and, if valid, writes it to the data (model), then updates the view.
    At no point will the view have to render invalid data, because the model is only updated after actionPerformed checks the value.
    The pattern may be applied with different classes performing the three roles, or different methods in the same class (sometimes it's easier that way for simple cases).
    Pete

  • I just buy iPhone4 first hand on Jan 07,2013 but the warranty expire date How can i check for the date of production?

    I was bought iPhone4 16 GB on Jan 07, 2013 from online shop from Laos they told me that this iPhone from Apple in Hongkong (first hand) but I check for the warranty is already expire date. What should we do? I want to know about my iPhone4 first hand or second hand. How can i check?

    This will show you warranty status and give you an idea
    of when originally sold:
    https://selfsolve.apple.com/agreementWarrantyDynamic.do

  • How do I check for null parameters in  Process Validations?

    I am trying to create a Unit Test that validates that a record has been inserted into a table. However I am having problems when dealing with null parameters.
    I created a simple table and insert procedure:
    create table TEST_TAB (
    A varchar2 (30) not null,
    B varchar2 (30));
    create or replace procedure TEST_TAB_INS (P_A in varchar2, P_B in varchar2) is
    begin
    insert into TEST_TAB values (P_A, P_B);
    end;
    Then I created a Unit Test with two implementations:
    The first executes TEST_TAB_INS ('One', 'Two')
    The second executes TEST_TAB_INS ('One', null)
    I attached the following Query Returning Rows Process Validation to both implementations:
    select *
    from TEST_TAB
    where A = '{P_A}'
    and (B = '{P_B}' or '{P_B}' is null)
    This should allow for the case where P_B is null. However the second test fails with a "Query check returned no rows" error.
    I've tried altering the test to use nvl, but get the same results:
    select *
    from TEST_TAB
    where A = '{P_A}'
    and (B = '{P_B}' or nvl ('{P_B}', 'XXXX') = 'XXXX')
    However, the following test succeeds:
    select *
    from TEST_TAB
    where A = '{P_A}'
    and (B = '{P_B}' or nvl ('{P_B}', 'XXXX') = '{P_B}')
    Which suggests that null parameters are not being treated as nulls in Process Validations

    I've found a way to solve this. By changing the test to:
    select *
    from TEST_TAB
    where A = '{P_A}'
    and (B = '{P_B}' or '{P_B}' = 'NULL')
    I am able to get both to get both implementations to succeed.
    Edited by: AJMiller on Dec 28, 2012 4:24 AM

  • How can i check for corrupt data

    I have a lot of machine embroidery designs stored on my imac and have reason to believe some may have corrupt data which is not evident when opening but has caused major damage to memory board in sewing machine. Is there anyway to scan for corrupt files?

    My wifes sewing machine is in for service and repair because a couple of designs in the memory have somehow become too big for the machine to open them so it is not possible to edit or delete them. I sent the designs to brother and their machines developed a problem as well so they had to change the memory board and they can only put it down to a corrupt file even though they can't prove it as virus scans show all clear and the designs work fine on the computer with the sewing software program. Our machine worked fine except for not being able to remove 3 designs. Brother said their machines version number changed and also couldn't remove the designs. I have read that if a file is corrupt, backup software will detect it but again no problem there. I have sent the suspect designs to someone in the US who is going to access the design and see if they can find anything but at the moment I can't get any answers because its never happened before. Any ideas would be greatly appreciated.
    Regards
    Dennis

  • How to Sign Up for Cellular Data on USED Ipad?

    Hello,
    Bought a used Ipad. When trying to sign up for a cellular data account I get
    Login information
    email
    password
    Next
    When going to att's website and entered the imei and iccid it again asks me for an email address and password.
    It looks like the Ipad is still asking for the original owners email and password.
    I've tried to "Reset All Settings", "Erase All Content and Settings", and "Rest Network Settings" on the Ipad, and it still asks for an email and password
    I hook it up to my Vista Computer and it sync's to the Itunes 10 on it. But I don't see how I can change the option to allow me access to open a new cellular data account.
    Any ideas on how to open a 3G account for this Ipad?
    thanks

    Ahh, I'm beginning to see a trend here.
    Thanks, I'm going to get a new SIM card.
    Thanks all for your help

  • Checking for null value in arraylist

    Hi
    i have an excel file which i i am reading into an arraylist row by row but not necesarrily that all columns in the row mite be filled. So how do i check for null values in the array list.
    try
                        int cellCount = 0;
                        int emptyRow = 0;
                        HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(file));
                        HSSFSheet sheet = workbook.getSheetAt(0);
                        Iterator rows = sheet.rowIterator(); 
                        myRow = new ArrayList();
                        int r = 1;
                             while (rows.hasNext())
                                  System.out.println("Row # " + r);
                                  HSSFRow row = (HSSFRow) rows.next();
                                  Iterator cells = row.cellIterator();          
                                  cellCount = 0;
                                  boolean isValid = false;
                                  while (cells.hasNext())
                                       HSSFCell cell = (HSSFCell) cells.next();
                                       switch (cell.getCellType())
                                            case HSSFCell.CELL_TYPE_NUMERIC:
                                                 double num = cell.getNumericCellValue();     
                                                 DecimalFormat pattern = new DecimalFormat("###,###,###,###");     
                                                 NumberFormat testNumberFormat = NumberFormat.getNumberInstance();
                                                 String mob = testNumberFormat.format(num);               
                                                 Number n = null;
                                                 try
                                                      n = pattern.parse(mob);
                                                 catch ( ParseException e )
                                                      e.printStackTrace();
                                                 System.out.println(n);
                                                 myRow.add(n);                                             
                                                 //myRow.add(String.valueOf(cell.getNumericCellValue()).trim());
                                                 //System.out.println("numeric: " +cell.getNumericCellValue());
                                                 break;
                                            case HSSFCell.CELL_TYPE_STRING:
                                                 myRow.add(cell.getStringCellValue().trim());
                                                 System.out.println("string: " + cell.getStringCellValue().trim());
                                                 break;
                                            case HSSFCell.CELL_TYPE_BLANK:
                                                 myRow.add(" ");
                                                 System.out.println("add empty:");
                                                 break;
                                       } // end switch
                                       cellCount++;
                                  } // end while                    
                                  r++;
                             }// end while
                   } myRow is the arrayList i am adding the cells of the excel file to. I have checked for blank spaces in my coding so please help with how to check for the black spaces that has been added to my arraylist.
    I have tried checking by looping through the ArrayList and then checking for null values like this
    if(myRow.get(i)!=null)
      // do something
    // i have tried this also
    if(myRow.get(i)!="")
    //do something
    }Edited by: nb123 on Feb 3, 2008 11:23 PM

    From your post I see you are using a 3rd party package to access the Excel SpreadSheets, you will have to look in your API for you 3rd party package and see if there is a method that will identify a blank row, if there is and it does not work, then you have to take that problem up with them. I know this is a pain, but it is the price we pay for 3rd party object use.
    In the mean time, you can make a workaround by checking every column in your row and seeing if it is null, or perhaps even better: check and see if the trimmed value of each cell has a lenth of 0.

  • How can i check my purchase date for my apple 5s

    how can i check my purchase date for my apple 5s

    Plug the SN in here:
    https://getsupport.apple.com/ProductSelector.action
    iPhone warranty starts the day the phone is first sold.

  • How to check for null values in bpel?? Please Help! very urgent!!!

    Hello Guys,
    I have a problem. I have an external webservice to which I have to post my request. My task is to create an Webservice and Service Assembly to which others would post request and get response. I have to create SA to deploy onto the bus.
    The problem is that there are optional elements in the request and response xsd's. In the Response sometimes certain feilds may come or they may not. for Example:- my response could contain a tag like this <firstName></firstName>
    I have to copy these feilds in my bpel process from one variable to another.(like in the mapper).
    My Question is , Is there any way in BPEL process or BPEL mapper where I could Check for null values in the request or response???
    Your inputs would be very helpful.
    Thanks
    Rajesh

    Thanks for replying man :)
    Ok I will be more clear.
    Here is a snippet of one of the xsd's that I am using.
    <xs:element name="returnUrl" nillable="false" minOccurs="0">
                        <xs:annotation>
                             <xs:documentation>Partner specifies the return URL to which responses need to be sent to, in case of
    Async message model.
    </xs:documentation>
                        </xs:annotation>
                        <xs:simpleType>
                             <xs:restriction base="xs:anyURI">
                                  <xs:maxLength value="300"/>
                                  <xs:whiteSpace value="collapse"/>
                             </xs:restriction>
                        </xs:simpleType>
                   </xs:element>
    This means that the return URL field can be there or it may not be there. But if it is there it cant be null because nillable=false. But the whole <returnURL> </returnURL> can be there or it may not be there because minOccurs=0.
    My requirement is , if returnURL is there in the response with a value, then in my BPEL mapper I should map it else I should not map it.
    Thats the issue.
    and Yes kiran, the node be non-existant.
    So can you please help me with this.
    Thanks
    Rajesh

  • Check for null or empty in the functoid

    I want to check for null and empty values on input source node. If there exists a null or empty in the input source node, I should not pass that to output destination node. Does the
    following attachment work? I want to check for null or empty in the date and time and then concatenate them to send to output. If any of them is null or empty, the other should not fail. In the Not Equal Functoid I am checking for blank, but how to check for
    null?

    A null check might not be you best option.  If your requirement is you must have both the date and time component supplied in order to populate EventDate, then I would use a Script Functoid that takes data and time as parameters.
    In the C# method, first check if either is an empty string, if so return an empty string.
    If not, TryParse the data, if successful, return a valid data string for EventDate.  If not, error or return empty string, whichever satsifies the requirement.

  • Check for null and empty - Arraylist

    Hello all,
    Can anyone tell me the best procedure to check for null and empty for an arraylist in a jsp using JSTL. I'm trying something like this;
    <c:if test="${!empty sampleList}">
    </c:if>
    Help is greatly appreciated.
    Thanks,
    Greeshma...

    A null check might not be you best option.  If your requirement is you must have both the date and time component supplied in order to populate EventDate, then I would use a Script Functoid that takes data and time as parameters.
    In the C# method, first check if either is an empty string, if so return an empty string.
    If not, TryParse the data, if successful, return a valid data string for EventDate.  If not, error or return empty string, whichever satsifies the requirement.

  • ViewCriteriaRow attribute to check for null or not null

    I Want to apply a view criteria to check for null or not null on a column , i see examples on how to set for value like
    vcRow.setAttribute("Sal", "> 2500")but i need to check for Sal is null or not null ,
    tried vcRow.setAttribute("Sal", null) and it is not working
    and vcRow.setAttribute("Sal", "is null") gives me error .
    can somebody help with correct syntax for this
    Thanks for your time

    looks like vcRow.setAttribute("Sal", "null") works

  • How can i check the planned data vs actual data

    How can i check the planned data vs actual data with the infocubes?

    Hi Srinivas,
    You create one cube for plan data and create another cube for actual data.
    Create a multiprovider and give comparision report. this is betterway.
    Or you can also load actual and plan data in one cube but you need to maintain one character like version to seperate atual and plan data.This is not a good work.
    Regards,
    Vijay.

  • Page Validation - Function Returning Boolean - Check for NULL

    I have 3 Page Validations which all fire on "When Button Pressed" = "Submit".
    <br><br>
    Number 1 is of type "Item specified is NOT NULL" for "P199_BUSINESS_UNIT1".
    <br>
    Number 2 is of type "Item specified is NOT NULL" for "P199_BUSINESS_UNIT2".
    <br>
    Number 3 is of type "Function Returning Boolean" and has the following code:
    <br><br>
    IF :P199_BUSINESS_UNIT1 IS NULL   AND
       :P199_BUSINESS_UNIT2 IS NULL  THEN
        RETURN FALSE ;
    ELSE
        RETURN TRUE  ;
    END IF ;<br>
    When P199_BUSINESS_UNIT1 is NULL and P199_BUSINESS_UNIT2 is NOT NULL, I get the Error from Validation 1. Perfect.
    <br>
    When P199_BUSINESS_UNIT1 is NOT NULL and P199_BUSINESS_UNIT2 is NULL, I get the Error from Validation 2. Perfect.
    <br>
    When P199_BUSINESS_UNIT1 is NOT NULL and P199_BUSINESS_UNIT2 is NOT NULL, I don't get an Error Message. Perfect.
    <br><br>
    When P199_BUSINESS_UNIT1 is NULL and P199_BUSINESS_UNIT2 is NULL, I get Error Message 1 & 2, <strong>but nothing from 3.</strong>
    <br><br>
    If I change the code to:
    <br><br>
    IF :P199_BUSINESS_UNIT1 = '01'   AND
       :P199_BUSINESS_UNIT2 = '01'  THEN
        RETURN FALSE ;
    ELSE
        RETURN TRUE  ;
    END IF ;<br>
    and change both values to '01', I get the appropriate Error Message.
    <br><br>
    What is going on? Is there some reason I can't check for NULL in a Function Returning Boolean?

    Scott,
    <br><br>
    Instead of adding the Validations, I changed my code from:
    <br><br>
    IF :P199_BUSINESS_UNIT1 IS NULL   AND
       :P199_BUSINESS_UNIT2 IS NULL  THEN
        RETURN FALSE ;
    ELSE
        RETURN TRUE  ;
    END IF ;
    <br>to the following and got the desired results:
    <br><br>
    IF  REPLACE(:P199_BUSINESS_UNIT1,<strong>'%null'</strong> || '%',NULL) IS NULL   AND
        REPLACE(:P199_BUSINESS_UNIT2,<strong>'%null'</strong> || '%',NULL) IS NULL  THEN
        RETURN FALSE ;
    ELSE
        RETURN TRUE  ;
    END IF ;<br>
    Note that I changed the word REPLACE to upper case and the second occurrence of the word NULL to upper case to accentuate the fact that the '%null' is case sensitive, using "%NULL' does not work, it has to be "%null' in lower case.
    <br><br>
    <strong>Thanks for your help.</strong>

Maybe you are looking for

  • Is is possible to display KB Sent/sec on OLT Graphs?

    I know there is the data series for "KB Rcvd/sec" available on the standard OLT graphs, but is there an equivalent for SENT? Also is there a way of seeing the total packet/request size of a request in OpenScript? I'm particularly interested in a webs

  • Changing Vertical display to horizontal in Crystal report 10

    Post Author: arun.net CA Forum: Charts and Graphs Hi. I am working in one of the .net application where we are using Crytal report version X(10) for report generation. I have Week_start(Data type Date) as field in the graph,but by default is displayi

  • Firefox for MAC OS 10.4.11

    After downloading the latest version of Firefox, it will no longer launch. I suspect it is because I have OS 10.4.11 with and IntelCore 2 Duo Processor. Is there a version of Firefox I can download that will work on my MacBook Pro?

  • How to stop a process chain tempararly

    Hi we have a process chain BI (7.0) which extracts data from R/3 scheduled everyday at 6AM. However, our basis team is shutting down the R/3 server around this time for maintenance. I want stop the process cain for this day and start regular schedule

  • Changes to the infoobject are not reflecting in the query Desinger level.

    Hi All, We removed some Attributes to one characteristic and transported into QA. The removed attributes are not getting in BEx query designer in Dev, But we are getting those removed attributes in the context menu of that particular Char in BEx Desi