Default date in hidden input field

Default date in hidden input field

avrrravrrr Posts: 17Questions: 3Answers: 1

Hi

I am trying to implement a date field (named Reg_date in the MySQL database) for Datatables Editor. The problem I am facing is to get this field to, first of all, be hidden, which I achieve by:

type: "hidden",

and secondly to default to the current date, which is done by:

"def": function () {
return new Date();
},

but, seeing that I have the filed type as "hidden", I cannot assign the type as "DateTime" as well, or I simply don't know how to.

Here is my PHP as well:

Field::inst( 'Reg_date' )
->validator('Validate::dateFormat', 'd-m-Y')
->getFormatter('Format::date_sql_to_format', 'd-m-Y')
->setFormatter('Format::date_format_to_sql', 'd-m-Y'),

The field must NOT update when editing a record as this field is used as the registration date for the member.

! This is for an existing database with date fields stored by the client as e.g. 31.08.05 which would translate to 31 Oct 2005.

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 7,242Questions: 0Answers: 1,222
    Answer ✓

    This is a duplicate of this thread. Please only post once.

    Colin

  • avrrravrrr Posts: 17Questions: 3Answers: 1

    My apologies, I posted it as a discussion and not a question, you can remove it.

Sign In or Register to comment.