Skip to content

How to set picker value from custom javascript #95

@nicholas-ewing

Description

@nicholas-ewing

I have a button which I want to do a few different things at the same time and I'm lost on how to set the picker's value to the current datetime from my JavaScript. I've tried setting the picker directly and I'm able to see the datetime in the field, but it doesn't carry over to the hidden input. I then tried setting the hidden input directly but it also did not carry over to be visible in the field. Is there a better way to do this than to individually set both?

Setting Picker Field:
$('#completed-datetime')[0].value = dtFormat(new Date(), 'yyyy-mm-dd hh:mmi:ss');

Setting Hidden Input:
$("[name='datetime_completed']")[0].value = dtFormat(new Date(), 'yyyy-mm-dd hh:mmi:ss');

Thanks in advance for any assistance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions