How to prevent default saveRecord() function of submit button

Hello,

I’m seeking assistance in implementing pre-submission checks for a form. Unfortunately, using JavaScript, I’ve encountered difficulties in preventing the default form submission behaviour.

Does anyone have a code snippet or suggestions on how to achieve this successfully?

Your insights would be greatly appreciated.

Can you give us mre detail on what you are trying to accomplish?

Hi @SuiteUpstairs ,

I’m currently developing an application that involves recording entries within a day, each with a designated start time and end time. As part of the validation process, I need to ensure that the time entered by a specific user does not overlap with existing time intervals.

To achieve this, I intend to implement a check during the form submission process using TB REST API filter. If the entered time falls within a time interval already present in the system, I want to prevent the save action to avoid conflicts.

Please let me know if you require any additional information or if there are specific details you’d like me to provide. Your guidance on this matter would be greatly appreciated.

I see. Unfortunately, i dont think that will be possible with a form component at this time, as far as i know. Hopefully there is another way to achieve this. Good luck!

@girish.kamble
I believe you don’t need an API call; I achieved this by simply adding validation rules. Allow me to explain my requirements and what I implemented:

Task: I needed to add a user appointment form but wanted to avoid overlapping entries on the current date.

Steps Taken:

  1. Added a “Date Range” field in my Appointments DataTable.
  2. Navigated to Page Builder → Page → Added Form Component for the Appointment Form.
  3. In the Form’s Rules section, specifically in the Validation Rule, I added a condition, as illustrated in my screenshot.

This approach ensures that the user appointment form adheres to the specified rules, preventing overlapping entries on the current date. If you have any further questions or if there’s anything else you’d like assistance with, feel free to let me know!

Hello @christopher93,

I attempted to implement the rule as per your instructions, but I’m unable to observe the dropdown value indicating “conflicts with existing record.” Is there an alternative method to include that value in the dropdown list? Please refer to the screenshot below for clarification:

If the field is a “Date Range,” it should display the condition “conflicts with existing record.” It seems like there might be something missing in this context.

Hi @christopher93,

Is it possible to assign a value from the “Date Range” to the “Time” field using javascript or any other way. I have a case where I want to put the same value as from “Date Range start time” to the time field “Start time”.