default time without date

elle

Member
Hi there,

how is it possible to get a default time in a date element with time selector without having a default date?
Just like to see in this screenshot:

Bildschirmfoto 2014-11-12 um 21.16.35.png

Thanks for your help!

Nice Regards
Elle
 
Hi troester,

thank you for your reply.
At the end it should be a date_time to store in the database.
It's just for displaying in the form when the user creates a new recordset as default.

Do you have any idea?
 
Have you tried using some custom CSS to hide the date selector?

Might be a little awkward as the date div doesn't have an ID ... but you should be able to get at it with something like ...

Code:
#yourtable___date_element:first-child {
   display: none;
}

... in a custom_css.php for your template.

-- hugh
 
Hi Hugh,

the date selector should'nt be hided! The user should be able to pickup a date. But per default the date input should be filled by nothing (not the todays date!) to pretend a early submit without a correct date.

You know what I mean?
 
Ah. In which case ... you would probably need to do that in JavaScript.

Basically, you'd need to set your element's default to use some valid date part, along with the time you want to default to, like ...

Code:
2014-02-27 10:00:00

Then create a JavaScript event on that element, on 'load', which does this:

Code:
if (Fabrik.getBlock('form_1').options.rowid === '') {
  document.id('fab_junk___test_date_cal').value = '';
}

This works out if it's a new form (rowid === ''), and if so, sets the date part of the element's DOM to be empty.

Replace the 1 in form_1 with the numeric ID of your form, and the fab_junk___test_date_cal with you element name (but with _cal still appended, which identifies the date part of the DOM structure for that element).

-- hugh
 
NOTE - although I've tested that this works for opening a new form, I haven't tested to see what happens if you submit without selecting a date, or how that would require validating, etc. But it works for removing the year from being visible when opening a new form.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top