OK so im playing around and struggling with the use of no code here.
So on my form i have a start date (date picker) and an end date (date picker) field for reservations. What i want to do is default the end date chooser to the start date as an end date cant be before a start date. This is done when the user starts to input these details through a form
Also how would i check the end date the user then chooses isnt before the start date ?
I’ve tried asking various AI but they all refer to putting code in the default field which doesnt seem to work,
Heres a default from gemini (google ai)
Blockquote
There are two ways to set a default value for the End Date:
Glide Settings:
Go to the “Settings” tab in Glide.
Navigate to “Data” settings.
Under “Default Values,” find the “End Date” column.
Set the default value to Current Row's Start Date (or equivalent depending on your column name). This automatically sets the End Date to match the Start Date when creating a new reservation.
Glide Formula (Alternative):
In the “End Date” column properties, set the default value to a formula:IF(ISBLANK(Start Date), "", Current Row's Start Date) This formula checks if the Start Date is empty. If empty, it leaves the End Date blank. Otherwise, it sets the End Date to match the Start Date.
I tried both, neither work, well the first solution doesnt even exist ini the free version ???
AI is really good at making things up. It has it’s uses, but it’s not always perfect. This is the same technology that can produce images of people with 16 fingers and limbs growing out of their head. Take it with a grain of salt. Both of the results you provided don’t make any sense within Glide.
Short answer is that it’s not possible to set a default on the fly within a native form. You can set it on the way in, but not while you are in the form. In most other cases, setting a value requires an action called by the user doing something.
Your best bet is to create a custom form instead of a native form. It’s more work, but gives you a little more flexibility. You still won’t be able to set a default end date based on a start date unless you have an additional button to write the start date to the end date…and you won’t have full control to restrict which dates a user can choose. What you will have with a custom form is the ability to create your own submit button with a custom action that first does some validation. If the end date is before the start date, then you can show a warning message instead of adding a row.
Ah i get you with AI, it was so confusing as it seemed to offer real world solutions but didnt make an ounce of sense when i went to implement it, which is such a shame.
Ok im actually very surprised this cant be done in a mature development environment like glide as its often used on many many apps (bookings etc for instance). I would have though that using the date picker (or any item input) could have a toggle to dynamically input that data as the user fills them in so they can be referenced elsewhere in the form.
So user case scenario for a holiday booking app
A user is going away in 20th August 2024 for 7 days, so he / she goes to input this for the first time in my form. They navigate the start date to the 20th August but then go to set the end date and that reverts to todays date, causing much issue for both confusion and indeed error as they then have to navigate up to August 27th.
An end date would never be before a start date in any case scenario. Logically from a new user in glide setting the default value from the start date into the end date data picker seemed logical, but indeed i now understand that the screen input isnt captured until it writes to the data fields.
My next try was Values from screen but that didnt function the way i assumed either, very confusing for no code that you end up spending longer trying to find solutions to what should be simple problems (the entire opposite effect of the reason for no code in the first place).
If you say it cant be done it cant be done but that has me doubting whether i’m going to be constantly banging my head trying to find workarounds or just putting up with things the app should do but cant due to backend implications Such a shame as im loving the development in glide.
Thanks again for the response. I know this all sounds negative but feedback like this to the developers needs to be done as a non coder who wants to focus on app development and not workarounds at every given turn to achieve something that should, in retrospect, be simplistic.