Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author xnau webdesign

    (@xnau)

    This is something you’d need a custom template for. You’d define your timestamp field as a text field, then in the template, you set the value of the field with the current date and time before it’s printed. You would also want to set it to read only at that time. You can’t set the read only in the field definition because that will prevent the value from being saved.

    Take a look at this article, it can get you started:

    Using Participants Database Custom Templates

    Thread Starter juicyroots

    (@juicyroots)

    Quick question on this, you said:

    then in the template, you set the value of the field with the current date and time before it’s printed

    I have a custom template, I have a variable for date/time ready to go. How do I populate a specific text field before the field elements are populated on the page?

    Thanks,
    T

    Plugin Author xnau webdesign

    (@xnau)

    Pretty easy, after the $this->the_field() call, you can alter the field before the $this->field->print_element_with_id(); with something like this:

    $this->field->value = $timestamp;
    $this->field->readonly = true;

    That should do it.

    Thread Starter juicyroots

    (@juicyroots)

    Thanks for the reply xnau!

    Sorry, I must be missing something. How does that code target a single specific field (when it will be looping through all of them)?

    – T

    Plugin Author xnau webdesign

    (@xnau)

    Take a look at the article on using templates, there is an example that shows how to target a specific field.

    Using Participants Database Custom Templates

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Show Read Only Field Populated with Current Date and Time’ is closed to new replies.