Hi, all...
I had make a dynamic web page for leave request. Can i make a button to let the manager approve it by clicking a button? and at the same time, the database will receive a name to the column of "Approve by".
For example :
Manager A login to his personal page and saw a leave request of his department.
To approve the leave request, he had click the "approved" button at the page.
At the another side, when HR department check the "leave request"database, he will saw every info of the request (by who & when to when) and the "Manager A" will able at the column of "approve by".
Another question is...
Can i let the date only show in "DD/MM/YYYY" without the time?
The time is from date picker.
Thanks for helping. ^_^
Sorry for late reply...
Thanks for helping. ^>^
https://editor.wix.com/html/editor/web/renderer/edit/7cb69cb5-4369-46c0-a843-c806ecc4b3c4?metaSiteId=e8022920-b32a-4a02-8ee8-f442bd82f843&editorSessionId=C836D617-190E-4C2F-8A9E-28D6D40E1E8C
Please send us your site url so we can take a look at it.
Thanks Dor Itzhaki,
I tried your code....but seem like not work
My code is like below...
import wixUsers from 'wix-users'; .... $w.onReady(function () { $w('#dataset5').onBeforeSave(async function () { const email = await wixUsers.currentUser.getEmail(); $w('#dataset5').setFieldValue('approvedBy', email); }); });
My data set for the leave form is #dataset5, and my staff list is #dataset1, button of approve is #button26.
And the date that showing in mt page is like above...All i need is just DD/MM/YYYY and maybe week.
Can i know why the button not showing "Approve" (at the green box)?
Thanks a lot.
Hello Jery,
If i understood correctly, the following code show help you achieve what you've requested:
import wixUsers from 'wix-users'; $w.onReady(function () { $w('#dataset1').onBeforeSave(async function () { const email = await wixUsers.currentUser.getEmail(); $w('#dataset1').setFieldValue('approvedBy', email); }); });
Assuming the "Approve" button is connected to the dataset's "Submit" action, the code above will make sure to save the current logged in user's email in the field named "approvedBy" whenever the button is clicked.
Regarding your 2nd question - i did not understand, how are you currently showing the date/time ?