Abort Save when Date is not in line with date range

  • 0
  • 1
  • Question
  • Updated 5 years ago
  • Answered
I have a formula checkbox field which returns true if the date entered in the "Date" field is valid. For example, if the year is 2010, the date range for the Date field should be between 1/1/2010 and 12/31/2010. My form rule states that if the formula checkbox is not true then abort the save. This works perfectly when the Date is input by using the calendar widget to the right of the field. However, if I enter the date in manually the rule fails to work. This is very strange to me and I haven't been able to find something around this issue. Can anyone help??
Photo of Niraj

Niraj

  • 0 Points

Posted 5 years ago

  • 0
  • 1
Two questions.  Can you try making that form rule be among the first form rules near the top.  Also, does the form rule fire if you enter the date and then tab out of the field, then save?
Photo of Niraj

Niraj

  • 0 Points
Thanks, Mark.

I have two rules set up around this scenario. One is a show/hide the formula checkbox based on whether the date field is null. The formula checkbox shows when the date field is not null.
The second rule is when the formula checkbox is not true, abort the save (after checking).
The form rule fires true/false regardless if i enter the date using the widget or manually typing it in. Only when I manually enter the date in does the rule for aborting the save not function.
I have always found that Abort the Save rule to be a bit sketchy in its reliability.  Did you try making that Abort the save the first form rule?
Photo of Niraj

Niraj

  • 0 Points
Yes, after your first comment, I moved the abort the save rule to be #1 on my rules list and it still kept failing if dates were manually entered.
Well, I have no more ideas on how to get your rule to fire.  if you decide to go to QuickBase support, let us know how you made out.

If you REALLY want a work-a-round and this does not hurt your head too much, you can make a formula field called [Date is Invalid] that calculates to anything - say the phrase  "Not Unique" if the date is not null and yet is invalid.  Mark the field as being Unique.  Unique formula fields are allowed to be blank as duplicate blanks are not considered to be non-unique.  Then save a dummy record with an invalid date.  (Conveniently for you, your form rules will not prevent you from doing that doing that!).

Then try to save another record with a bad date.

You will get a very big red message which in a convoluted way (given your careful choice of the field name of [Date is Invalid])  will tell the user that their date is invalid.)  That method will be rock sold as the QuickBase database will not accept duplicates if you mark a field as being unique.

Give that one a try as its quick to set up a test.
Photo of Niraj

Niraj

  • 0 Points
Thanks, Mark. I had to re read your process a few times to understand it. I think the process makes sense in my head and I'm eager to give it a shot tomorrow morning. I'll update you on how it works for me. In addition, I'll also reach out to QB support on this "bug".
Photo of Niraj

Niraj

  • 0 Points
I got a response from Quickbase on my issue, and they were no help whatsoever. See below:

Hello Niraj,


Thank you for inviting me into your app. Upon further review, it doesn't look like there is a work around for your issue. The only way to get the form rule to work properly is to have the individuals who are using the app use the calendar widget to select the date. Technically, manually entering the date is using the from incorrectly. I am sorry there isn't a way around this issue. If you have any other questions, let us know.


Regards,


Lovell P.
Wow, crazy.  Thx for posting this.  I have one more suggestion.  Can you try making a formula field equal to the date field and then make your Abort Rule based on the formula field?  ie a "mirror" field.  The form Rule should see formula field as long as they are on the form - even if you then decide to hide the formula date field with a trial rule like if date = 999999, hide field.
Photo of Sam

Sam

  • 20 Points
Hey Niraj,

Thanks for being part of the QuickBase Community! My name's Sam, from QuickBase Customer Care.


My suggestion would be to skip the "Abort the Save" form rule, and use the formula checkbox and a Required Standard Checkbox.

What you'll do is create a normal checkbox field, set it to Read Only and Required. Create a Dynamic Form Rule: When the Formula Checkbox is Checked, Change the Standard Checkbox to Checked.

As you're able to require standard checkboxes, but not formula checkboxes, you'll be able to force QuickBase to abort the save.

To make this transparent to users, you change the label for the standard checkbox to read something like "Valid Date Selected?", which will give the user an easy way to see if they've chosen a proper date.



Sam Jones

QuickBase Customer Care

Photo of Niraj

Niraj

  • 0 Points
Hi Sam! Thanks for your feedback. However, I don't seem to be able to make the formula checkbox field a required field on the form? Am I missing something? I've looked into the form rules and also the field rules but am not able to make it required.

Thanks!
Photo of Sam

Sam

  • 20 Points
Hey Niraj,
Sorry about that. I forgot a step from when I'd implemented this solution before. The missing step is using a form rule to "push" the check from the formula checkbox to a standard, read-only checkbox which is the checkbox you require. I've edited my original post to make things easier for anyone who references this community post in the future.

Sam Jones
QuickBase Customer Care
Photo of Niraj

Niraj

  • 0 Points
Thanks, Sam. I neglected to respond back but your tactic worked perfectly! I appreciate it!