Web Analytics Made Easy -
StatCounter How !! Javascript generate dynamic date field with date mask "mm/dd/yyy" - CodingForum

Announcement

Collapse
No announcement yet.

How !! Javascript generate dynamic date field with date mask "mm/dd/yyy"

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How !! Javascript generate dynamic date field with date mask "mm/dd/yyy"

    Hi folks,
    i am trying to generate a dynamic datefield with date mask "mm/dd/yyyy" and trying to insert it into Oracle db ...i still got the error ORA invalid month ehich means the date filed is not recognized as date:

    below is what i am doing :

    newStartDate = document.createElement( 'INPUT' ); newStartDate.setAttribute('type','Date'); newStartDate.setAttribute('id1','id'+ elementid+elementrow); newStartDate.setAttribute('name','StartDateName'+ elementid+elementrow); newStartDate.size=8; newStartDate.style.backgroundColor= bgc;

    any help thanks ??

    Also i want to add a datepicke to this textbox..how it is posible / other option is to use Jquery datepicker but could not know how to impement it

    thanks again

  • #2
    The whole thing sounds rather fishy. If this is about putting something into a database (and not about outputting something to the user), you have to do some sort of server side validation anyway, so why bother with Javascript at all? Even if you used Javascript to provide the right format, that format is merely a "suggestion", which can be easily overridden. If the database requires a certain format, your server side script has to accept every possible input and do the validation and format conversion itself, without choking on a wrong date format.

    As for the date picker: You're using the HTML5 date input, and as you surely know, the whole HTML5 thing is rather new. It's the browser's job to provide the input UI for HTML elements, and as of yet, most browsers just don't provide a date picker (Opera does).

    You can, of course, use some jQuery date picker, but if you don't know how to implement it, I'm afraid you only got two choices: try to do it anyway and get help if you get stuck, or pay someone to do it for you.
    .My new Javascript tutorial site: http://reallifejs.com/
    .Latest article: Calculators — Tiny jQuery calculator, Full-fledged OOP calculator, Big number calculator
    .Latest quick-bit: Including jQuery — Environment-aware minification and CDNs with local fallback

    Comment


    • #3
      Hi Venegal
      i could do it on the server side with no problem except that my textboxes that holds date are dynamically generated.

      I will figure out .

      thanks again for the advice.

      Comment


      • #4
        Adding javascript to check for the right format wouldn't be hard. That way if the browser doesn't support type="date" you would at least have JS backup.

        But you'd need to add it in to your <forn onsubmit> also.
        Be yourself. No one else is as qualified.

        Comment


        • #5
          Originally posted by korssane View Post
          i could do it on the server side with no problem except that my textboxes that holds date are dynamically generated.
          The server side doesn't care whether your field is generated dynamically or has been there in the HTML all along. It just cares about the post data, and won't even know the difference.
          .My new Javascript tutorial site: http://reallifejs.com/
          .Latest article: Calculators — Tiny jQuery calculator, Full-fledged OOP calculator, Big number calculator
          .Latest quick-bit: Including jQuery — Environment-aware minification and CDNs with local fallback

          Comment

          Working...
          X
          😀
          🥰
          🤢
          😎
          😡
          👍
          👎