Date Picker value not sending on Apply

I think this is a bug, I have a datepicker set to run a server action database update on Apply but the date value does not show up

<dmx-serverconnect id="sc_date_edit" url="api/image-manager/photograph-date-edit" noload dmx-on:success="scimagelist.load({})"></dmx-serverconnect>

<input type="text" class="form-control" placeholder="Please Choose Date" dmx-bind:value="mil_photographed_date" is="dmx-date-picker" timepicker="" use24hours="true" id="phoDate" name="phoDate" dmx-on:apply="sc_date_edit.load({what_image_id: mil_id, what_date: value})">


EDIT: Just out of interest this does not work with dmx-on:changed either, however it does work with dmx-on:updated

I suspect this is because the inputs for Datepickers are updated programatically as they use dummy inputs for presenting the desired formatting to the user. ‘Updated’ looks for programatic changes but the other two only respond to user events on that input - they are actually ‘interacting’ with the hidden field

Yeah, you are correct, its just a case of what came first, the chicken or the egg, but Wappler has an option for dmx-on:apply which worked at some stage, so I assume there must be a bug that has crept in, because they did already account for all the order of operation/precedence in this use case.

For now im fine using it as I have, but figured best to let them know in case they need to fix it.

1 Like

Just checking if there is any update / fix to the dmx-on:apply="" not working right?

I did state that I used the on:change to make this work, however it is not working well, so would love to have on apply working again.

Hey Paul, the onapply event can be used only for date range picker where you have the apply button. It’s not available for date picker.

Screenshot 2021-05-19 at 10.05.36

1 Like

Thanks so much for confirming Teo, although it was a sad answer, haha.

I just assumed it would work because mine had the Apply button.
Screenshot 2021-05-19 at 17.01.58

Do you think this is a function Wappler may consider adding to the single one as well?

Maybe @patrick can check if that’s possible.

1 Like

With the changed and updated event the value should have been set. The apply is triggered when the button is clicked, the value is then not yet set.

I have it with on-updated currently, but everytime my page refreshes and the dates propagate from the database, it fires all the on-updated for every element that has it, so the server network tab shows that script running over and over, which is why i think on-apply would work better for me.

I sent a PM with a link to the page @patrick

To prevent it running on every page load, you can use an inline flow for the dmx onupdated action with a conditional step so the action is only run when there is a vakue present or maybe the value does not match one from the database…

2 Likes

Yeah, there are a few ways around it thankfully, but would be great if the Apply button already included in the datepicker then worked with the on-apply event just like it does in the date range picker.
Thank you for the suggestion though, will probably do something similar to that.

2 Likes