Field Level Validation - Date Mask

Hi all
I need some Java Script to validate a date mask in a field. Format must be:
dd-mm-ccyy.
Can anyone help me?
Thanks

Here is a copy of the script I set up to do validation.
I not only wanted it to check for a valid date,
but I wanted to store leading zeros, but not make the user type them in.
One of the things you have to do is to set the format mask for the date to MM-DD-YYYY for each date field in your form.
Here it is:
var DayArray =new Array(31,28,31,30,31,30,31,31,30,31,30,31);
var MonthArray =new Array("01","02","03","04","05","06","07","08","09","10","11","12");
var firstDash = null;
var lastDash = null;
var inYear = null;
var inMon = null;
var inDay = null;
var today = new Date();
var curFullYear = today.getFullYear();
var strYear = String(curFullYear);
var thisCentury = strYear.slice(0,2);
var thisYear = strYear.slice(2);
var numThisYear = Number(thisYear);
inDate = theElement.value;
if (inDate.length == 0) return true;
/* Check for a valid format. */
var filter=/^[0-9]{1,2}-[0-9]{1,2}-[0-9]{2,4}$/;
if (! filter.test(inDate))
{ alert("Please enter date in MM-DD-YY or MM-DD-YYYY format.");
theElement.focus();
theElement.select();
return false;
/* Pick off the indices (zero-based) of the two dashes. */
firstDash = inDate.indexOf("-");
lastDash = inDate.lastIndexOf("-");
if ((firstDash == lastDash) | | (firstDash == -1) | | (lastDash == -1))
alert("Please enter date using dashes (-), e.g. MM-DD-YY or MM-DD-YYYY.");
theElement.focus();
theElement.select();
return false;
/* Pick off the month and day (pad with leading zero, if necessary). */
inMonth = inDate.slice(0,firstDash);
if (inMonth.length == 1) inMonth = "0" + inMonth;
inDay = inDate.slice(firstDash+1,lastDash);
if (inDay.length == 1) inDay = "0" + inDay;
/* Pick off the year. Filter ensures 2, 3, or 4 digit year. 4 is what we */
/* want, so we only have to deal with 2 or 3 digit years. */
inYear = inDate.slice(lastDash+1);
/* If the user entered a two digit year, figure out which century to pad. */
if (inYear.length == 2)
/* Adding 5 years is still within the current century... */
if ((numThisYear + 5) < 100)
/* 00 to (current year + 5 years) should use the current */
/* century; otherwise, use the previous century. */
if (inYear > (numThisYear + 5))
inYear = (thisCentury - 1) + inYear;
else
inYear = thisCentury + inYear;
else
/* Adding 5 years would rollover the century, use the current century */
inYear = thisCentury + inYear;
/* A 3 digit year is an error. */
if (inYear.length == 3)
alert("Please enter date with either a 2 digit or 4 digit year.");
theElement.focus();
theElement.select();
return false;
/* Check for a valid month. */
var filter=/01|02|03|04|05|06|07|08|09|10|11|12/;
if (! filter.test(inMonth))
alert("Please enter a valid month.");
theElement.focus();
theElement.select();
return false;
/* Check for leap year. */
N=Number(inYear);
if ( ( N%4==0 && N%100 !=0 ) &#0124; &#0124; ( N%400==0 ) )
DayArray[1]=29;
/* Check for valid days for the month. */
for(var ctr=0; ctr<=11; ctr++)
if (MonthArray[ctr]==inMonth)
if (inDay > DayArray[ctr] &#0124; &#0124; inDay <= 0)
alert("Please enter a valid day.");
theElement.focus();
theElement.select();
return false;
/* Output the fixed up date. */
theElement.value = inMonth + "-" + inDay + "-" + inYear;
return true;
Regards,
Rene'

Similar Messages

  • Field level Validation in SAP PI

    Hi All,
    I am integrating with a 3rd Party system (File to Proxy scenario). Source file contains around 30 fields. I was asked to do field level validations for each of this field in PI. Is this a good practice. Do we do field validation in PI Integration development? I think PI should contain more of integration logic than field level validations. Please suggest.
    Also out of all the 30 fields few are numeric, some are text and some are dates. While creating data types do I need to created all as string or based on their nature I need to use integer,date etc? Please suggest which is the best practice.
    Thanks.

    I agree with Rahul.
    Yes we can perform validation in PI (most of the cases we do by request of the Business team).
    But always have a thumb rule for your self.
    1. Check first weather the source system is capable of doing the validation at its end.
    2. If YES make sure the source system does the validations required. (I am sure most of the app would be able to the validation).
    3.If NO then accept the validation process to be done in PI end.
    One Important thing:
    What kind of validation are you taking about? i assume this is field level validation rite?
    and this is a Proxy to file scenario rite.
    I will strongly suggest you to do following things at source and receiver Business systems.
    1.gather a meeting the with the end business teams (source and receiver).
    2.Force them to create data type at their end (sorce and target)with  same data type structure- with same field length even.
    ie, if source first field is integer with maxlen25  corresponding reciver field is also integer with maxlen25, if source has char field then in reciver also its char.
    If you make both the source and reciever business to have same data type at there end, NO VALIDATION would be required to be done in PI
    also in this case you can declare all the data type as STRING in PI and pass the data to receiver system. (which has the same data type as sender).
    Regards,
    Senthilprakash.

  • Field level validation

    I was looking at the Add/Modify Customer page – page 7 in the Sample Application which can be loaded into Oracle XE and was surprised to discover that there doesn’t seem to be any field validation. For example customer first name is set to varchar2(20) at database level yet more than 20 characters can be entered into the application field and there is no error message when moving cursor focus to another field. Credit Limit field is numeric only but alpha characters can be entered and again, there is no error message when moving cursor focus to another field. Error messages are only displayed on hitting the Create button and even then they are standard ORA-99999 type messages – not very friendly to your average end-user I would suggest! I would be amazed if field-level validation (javascript maybe?) can’t be included in XE applications – assuming it can be, can anyone tell me how it works, even point me towards a working example – if I’m really lucky(!) Phil

    As part of the page editor, looks in the center for validations. Right there you can enable all kinds of validations required for the objects in your page.
    If you require you can use JavaScript to activate those validations also. Check the
    Page Definition = Validation
    You can use Item Validation or Page Validation.
    A look to the APEX user manual will help with more examples on this.
    Regards Dino.

  • Field level validations for an Infotype

    Hi,
    Can anybody tell me if  field level validations can be done for each and every field in a HR infotype?
    Thank you.

    You can do most of the validations using the Infotype User exit ZXPADU02 or the AFTER_INPUT mrthod in the BAdI HRPAD00INFTY.
    But each & every field  -- NO
    ~Suresh

  • Field level Validation in ADF

    Hi,
    We have some forms and we want to implement validation on field level. Means, as soon as i enter a value and move to next field, if the value entered is not as per desired regular expression than it should show the error. What i am trying is applying validator attribute on inputText and setting auto submit to true. It is working but some times page suddenly refresh itself and then the validation don't work.
    Also one validation is to match the passwords (new password and confirm password). If i am using above method i am also not able to get the correct value of new password to match eith confirm password.
    Can someone please suggest whats the right way to implement this functionality in ADF.
    I am using jDev 11.1.1.4 and using Placeholder data control.
    Please suggest
    Thanks

    If <af:validateRegExp> meets your requirements then sure, use it. The neat thing about the default validators will do both client side and server side validation. As such bypassing the JavaScript validators by sending raw HTTP requests to your server will still result in the required validation being applied via the server side.
    For cross field validation, that's most easily done at the JSF bean level. It will require a round trip to the server to perform the validation though (rather than just validated at the client level). Is that an issue? There's an alternative solution but if you're not worried about round trips, go with the simple solution.
    CM.

  • Script Data Component - System.DateTime.TryParseExact Method not validation date value

    Hello
    I have Script data component in my data flow task and i am trying to validate whether the date fields has valid date values or not.
    So i added below code to validate the date fields
    in below code TestDate is datetime and ValidTestDate is datetime as well.
    string[] formats = { "MM/dd/yyyy", "MM/d/yyyy", "M/dd/yyyy", "M/d/yyyy"};
    DateTime pDateTime;
    if (System.DateTime.TryParseExact(Row.TestDate.ToString(), formats, CultureInfo.InvariantCulture, DateTimeStyles.None, out pDateTime)==true)
                    Row.ValidTestDate = Row.TestDate;
    System.DateTime.TryParseExact is not validating to true even the TestDate is valid.
    I have even tried converting the datetime field to DT_DATE but it did not work.
    I appreciate any suggestion to accomplish the check whether it is valid date or not.
    Regards
    Harris

    This is because the string value of TestDate does not conform to either of the formats.
    Arthur
    MyBlog
    Twitter

  • How to fix the field level Error(Invalid Date)

    Hi All,
    Error: 1 (Field level error)
      SegmentID: ACK
      Position in TS: 5
      Data Element ID: ACK05
      Position in Segment: 5
      Data Value: 162014
      8: Invalid Date
    can anyone help me out, How to fix above error? i searched about this but only information about the error  is given and no where it is mentioned how to fix it  and how is it generated please help me out.
    Thanks,
    Nitish

    Are you sending or receiving the EDI?
    Either way, "162014" is simply not a valid EDI data format.  Dates in x12 are expressed as CCYYMMDD so December 30, 2013 would appear as 20131230.
    If you are receiving, you need to contact the sender and have them correct the output.
    If you are sending, you need to property format that date value.  For example:
    myDateVar.ToString("yyyyMMdd");

  • Masking at field level

    Hello SDNers,
    My concern is to allow view to several users by making MASKING AT FIELD LEVEL.
    To make it clear:
    Take one example of automobile giant in which certain views are needed :
    a)Higher Managment View (Total Access to all the fields,say all 10 fields)
    b)Sales View (which should be given access to say first 4 fields)
    c)Finance VIew (which needs to have acess to some 7 fields)
    As in the case mentioned i need Masking at Field level.
    Share your views.
    Solution will be rewarded.
    Rgds,
    Krutarth

    Hi Krutharth,
    Where do you want that view in data manager or you want  to view your user specific records (Fileds) on Web UI. If you want to view the records on web UI you can arrange the user specific views in the Config UI by selecting the fields you want your specific user to view.
    You can have field level masking i.e., you have to configure such masking on specific user in the config UI.
    Data Manager you cannot impose such mask at field level.
    Reward points if helpful.
    Prasad.......................

  • Page level validation to prevent duplicate data entry into the database

    Hello,
    Can anyone please help me out with this issue.
    I have a form with two items based on a table. I already have an item level validation to check for null. Now I would like to create a page level validation to check that duplicate data are not entered into the database. I would like to check the database when the user clicks on ‘Create’ button to ensure they are not inserting duplicate record. If data already exist, then show the error message and redirect them to another page. I am using apex 3.2
    Thanks

    Hi,
    Have you tried writing a PLSQL function to check this?
    I haven't tested this specifically, but something like this should work:
    1) Create a Page Level Validation
    2) Choose PLSQL for the method
    3) Choose Function Returning Boolean for the Type
    For the validation code, you could do something like this:
    DECLARE
        v_cnt number;
    BEGIN
        select count(*)
        into v_cnt
        from
        your_table
        where
        col1 = :P1_field1 AND
        col2 = :P2_field2;
        if v_cnt > 0 then return false;
        else return true;
        end if;
    END;If the query returns false, then your error message will be displayed.
    Not sure how you would go about redirecting after this page though. Maybe just allow the user to try again with another value (in case they made a mistake) or just press a 'cancel' button to finish trying to create a new record.
    Amanda.

  • Data conversion is necessary at field level

    Hi everybody.
    Im a BW consultant in a BCS project, and I had to make a change in a objetct that is used in BCS as a custom attribute.
    What I made, is to remove the ALPHA routine in the object.
    Later, the BCS consultant generetad the data basis again, and now when enter the UCWB a warning is showed, the message below:
    But I dont know how to do the procedure showed in the message, does anyone face with the same problem? Any suggestion? 
    Best Regards,
    Thiago
    Field /BIC/ZC_EMPBPM: Data conversion is necessary
    Message no. UGMD418
    Diagnosis
    Following a change to the definition of field /BIC/ZC_EMPBPM it is necessary to convert the old data for this field before the new attributes can be activated. This arises, for example, when the following attributes have been changed:
    Conversion exit
    Version or time dependency of hierarchies
    System Response
    You cannot start the application. A data conversion is necessary first.
    Procedure
    Execute the necessary data conversion at the field level. To do this, press the respective button with the  symbol in the hierarchical detail display at the level of field /BIC/ZC_EMPBPM. If necessary, the system will prompt you for more information in a separate dialog box.
    Regards!
    Edited by: Thiago  França Carvalho Silveira on Jun 10, 2010 11:13 PM

    Hi,
    I quess the following should help.
    Execute UCWB01 t-code, goto your data basis, in the tabstrip for assigning roles drag and drop any characteristic, then save. The system will find the change and check and regenerate data structures (that's what you need).
    Then either in UCWB or UCWB02 t-code got your ConsArea and regenerate it.

  • The SharePoint list query is not valid: Data at the root level is invalid. Line 1, position 1. (rsSPDataProviderError)

    Hi there,
    All my reports are throwing below error in a sharepoint site configured with Access services. Does anyone have a clue what's causing it?
    An error has occurred during report processing. (rsProcessingAborted)
     Query execution failed for dataset 'Default'. (rsErrorExecutingCommand)
     The SharePoint list query is not valid: Data at the root level is invalid. Line 1, position 1. (rsSPDataProviderError)
    Thanks
    Manvir

    Hi Manvir,
    For troubleshooting your issue, please go to C:\Inetpub\wwwroot\wss\VirtualDirectories\ find your Web Application (represented by a port number), then delete an unknown folder created by sharepoint, namely vti_cnf from all the folders and sub-folders in
    your web application.
    Reference:
    http://forums.asp.net/t/985790.aspx?Data+at+the+root+level+is+invalid+Line+1+position+1
    Best Regards,
    Eric
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Changing The Validity Dates In Org Model in CRM- User Level

    Hi
    How can we restrict the Validity Dates in Organisation Structure at User Level.
    I need that the user should be given some specific dates<b> ( Valid till or assigned till )</b> while assigning in the org. And it should be visible always in the Org Model.
    We tried using Delimited Date Function, but the User gets ellapsed if the Validity is expired.With the business point of view, <b>the requirement is that all user should be listed in Org model with respect to any dates.this would mean that if a user is terminated we would want to change the Valid till date in the Org</b>

    Hi Amrita,
    Business partner number and Object ID is automatically determines by system when creating a org unit.
    I dont find any configuration to create org unit with your own BP number and object ID. You have option to make repairs to the existing org unit.
    Please find the below path to repair the org unit
    IMG -> CRM -> Master Data -> Business partner -> Integration Business partner -Org management -> Create Business partner initially
    Select the org unit and execute to get all the org units.
    You can select the org units with errors /warnings and click on start repair to get automatic assignment of BP.
    Hope it helps
    Reward points if it helps
    Regards,
    Madhu

  • Adding item level validation to a field

    Hi All,
    I am new to Oracle APEX.
    I have a field named semester_code in my page and I want end user to enter only alphanumeric values. I want to create item level validation using regular expressions, but I don't know what expression to write for this purpose.
    Any help will be highly appreciated.
    Thanks
    Bilal

    Hi,
    Go to the validations section of the application builder (for the application you are working on)
    -> add item level validation
    -> select the field that you are trying to validate
    ->item string comparison
    -> select 'Item specified is alphanumeric' from list
    Chris

  • BOM Valid Date

    Hi,
    While creating BOM due to some human error we took wrong valid date.Now i want to change it.
    Please suggest me the T-code or any customization to change the same.
    "I am online"

    Dear Pawar
    This are the basic IMG settings in order to used the engineering change management
    features.
    x refers to a tick.
    First setup the control data in OS54.
    Revision sections
    Fields :-
    Revision level active            x
    Ext. revision level              x
    Higher revision level            x
    Object Management Record sections
    Fields :-
    Object maintenance               x
    Assign alternative date          x
    Overide value/assignment date sections
    Fields :-
    Only with leading change mst.    x
    Setting the Revision level active is to activate the engineering change management for
    material master.  If you do not want the engineering change management for materials,
    remove the tick.
    With a tick in "Higher revision level", the new revision level has to be always higher
    than the old revision.
    Secondly, setup the external number range in OS53.
    If you use the internal number range, then remove the external number range.
    Third, define the status for the change master records in transaction SM30 - V_T419S.
    Change No.     Chg        Date Chg     Dist. Lock      Description
    Status         Poss
      1             x            x             ' '         Active
      2            ' '          ' '            ' '         Inactive
      3            ' '          ' '             x          Locked
    Fourth, define modification parameters for the BOM in OS27.
    Fields :-
    BOM Validty Maint.               x
    EC Management Active             x
    History Requirement             ' '
    Unit Piece                      PC
    The rest of the fields are blank.
    If the History Requirement is tick, every time during creation of the BOM, SAP will
    prompt your for an ECN number as is compulsory.
    Lastly, define fields selection for routing in OP5A.
    PP task lists: initial screen -> Change number -> Transaction code -> Tick Req.
    Setting the Transaction code fields Required indicate that you have make the ECN number ........
    Hope this will help you one of our friends gave me this
    Pavan

  • How to reflect a new field in Bank data while making payment through F-53?

    Hello Experts,
    How can i reflect a new field (payment reference) in bank data while making payment through F-53?
    I have tried to do it by Field status group(OBC4) but the same is replicating in vendor invoice but not in vendor payment.
    I tried it at both level,fsg anf posting key,But no use.
    Is there any other process to make available and required field in BANK DATA of vendor payment?
    Please suggest .
    Regards,
    Sumeya offrin

    Hello Sumeya,
    Please consider note 145864 which explains what you have to do to
    make this field visible in your selection criteria:
    "In Transaction FB00 (Financial Accounting Editing Options -> Open items
    activate the flag 'Payment reference as selection criterion'.
    This is valid for incoming payment; please test if the same procedure
    is valid for outgoing payment as well.
    I  check the  issue, and unfortunately these function seems to not be supported for vendor open items.
    When you try to select the 'Payment Reference' in Additional selections
    the following messages is arised:
    'No account specified, items selected via document no. or reference'
    That means,when you do not specify an account in F-53 you can only
    via Reference and/or document. This is not a bug but system design.
    For additional reference you can check the note 451105.
    The note made clear that the specification of an account is required for vendors during the selection via payment
    reference.
    Kind Regards,
    Fernando Evangelista

Maybe you are looking for

  • My Photoshop CS4 crashes after last OS update.

    Can anyone help me with this?  Snow Leopard sucks!!!

  • Issue with Java cache

    Hi friends, I'm in PI 7.3 environment, my problem is - when I try to access ESB and IB, it says that it is Unable to download. So, for that am clearing Java cache and trying to download to get into ESB and IB every time. Obviously am wasting hours of

  • JDBC Adapter Error - SAPClassNotFoundException: oracle.jdbc.driver.OracleDr

    Hi, I am trying to implement JDBC to File scenario. Trying to connect to Oracle Database. Oracle drivers are installed on XI server JDBC Adapter parameters: JDBC Driver  - oracle.jdbc.driver.OracleDriver Connection - jdbc:oracle:thin:@10.25.228.156:1

  • In Gmail getting mail delivery failure

    Delivery to the following recipient failed permanently: This message was created automatically by the mail system (ecelerity). A message that you sent could not be delivered to one or more of its recipients. This is a permanent error. The following a

  • Have PSE 9 and wish to merge duplicated categories, sub-categories and keywords etc?

    Have PSE 9 and over the years have found have duplicated categories and subcategories and wish to know the best way to Merge and organise them. Also have a huge list of 'Imported Keywords' and not sure how they are formed and how to mege them with th