Search for answers or browse articles about Sintel Forms
Advanced Customisation and Code Samples
1. Redirecting the User on Form Load
This rule automatically redirects the user to a new URL when the form loads. It’s useful for guiding users to a specific page, such as a new form version or an external resource.
Why use it?
Maybe you updated your form and want users to go to the new version.
Maybe you want them to visit an external resource instead of filling out the current form.
How to Add this Rule
- In your form: Go to the Logic tab and click + Add a Rule.
- Set the Condition: Choose None (this will run the rule every time the form loads).
- Add the Step: In the Steps section, drag the step: Execute JS to the rule. Paste in the code below:
location.replace('https://google.com');
- Click Save
This will redirect to the new URL without creating a new entry in the browser history.
2. Email Confirmation Check
This rule ensures that two email fields match before the form can be submitted. It’s useful for improving data accuracy and avoiding sending emails to mistyped addresses by making sure the confirmation email matches the original.

How to Add this Rule
- Open the Logic Pane: In your form, go to the Logic tab and Click + Add a Rule.
- Set the Condition: Choose Custom JS function as the condition type and Paste in the code below. Remember to replace EmailAddress and EmailAddressConfirm with the exact field names from your form’s properties.
(getValue('EmailAddress') || "") !== "" && (getValue('EmailAddressConfirm') || "") !== "" && (getValue('EmailAddress') || "").toLowerCase() !== (getValue('EmailAddressConfirm') || "").toLowerCase()- Add the Error Message Step: In the Steps section of the rule, drag the step: Field – Set Custom Error to the step section of your rule. Select – Field: EmailAddressConfirm Error message: “Email addresses do not match”
- Save
3. Hyperlink Field
This rule sets the value of a hyperlink field dynamically. It’s useful for providing users with direct links to related documents or resources.
How to Add this Rule
- In your form: Go to the Logic tab and click + Add a Rule.
- Set the Condition: Don’t choose any or else choose or any condition you want the link to appear under).
- Add the Step: In the Steps section, drag the step: Execute JS and paste in the code below:
setValue("JobCardURL", {description: "view here", url: "https://www.google.com"})Save → Now, when the form loads (or when the condition is met), the hyperlink field is automatically filled with a clickable link.
4. User/People Field Check
This rule checks if two user fields, such as Requester and Manager, contain the same person. It’s useful to ensure approvals or submissions are not self-assigned, maintaining proper workflow rules.
Why use it?
Prevent users from approving their own requests and ensures workflows follow proper hierarchy.
How to Add this Rule
- In your form: Go to the Logic tab and click + Add a Rule.
- Set the Condition: Choose Custom JS function and paste the code below.
- Add the Error Message Step: Drag Field – Set Custom Error to the Steps section.
Field: Manager Error message: “The manager can’t be the same as the requester“- Save
getValue('Requester')[0].id == getValue('Manager')[0].id
5. Date Field Validation – End Date After Start Date
This rule ensures that the end date is later than the start date. It’s useful for scheduling forms, bookings, or tasks that require a valid date range.
Why use it?
Prevent users from entering an end date before the start date and Improve data accuracy for scheduling purposes.
How to Add this Rule
- In your form: Go to the Logic tab and click + Add a Rule.
- Set the Condition: Choose Custom JS function and paste the code below
- Make sure the field names inside getValue() are wrapped in quotes. For example, use getValue(“StartDate”) and not getValue(StartDate).
- Click Save
const dateFrom = getValue("StartDate"); const dateTo = getValue("EndDate"); if (dateFrom && dateTo) { const isFromSmallerThanTo = moment(dateFrom) <= moment(dateTo); if (!isFromSmallerThanTo) { setErrorMessage("EndDate", "End date must be larger than the start date."); } }
6. Date Field Validation – No Past Dates
This rule prevents users from selecting a date in the past. It’s useful for bookings, deadlines, or authorisation forms.
Why use it?
Avoid errors caused by submitting outdated dates and Ensure all submissions are relevant and timely.
How to Add this Rule
- In your form: Go to the Logic tab and click + Add a Rule.
- Set the Condition: Choose Custom JS function and paste the code below.
- Click Save
getValue("AuthorisedDate").setHours(0,0,0,0) < (new Date()).setHours(0,0,0,0) var today = moment().startOf('day'); moment(getValue("AuthorisedDate")).isBefore(today);
7. Character Count Validation
This rule checks the number of characters in a text field and prevents exceeding the limit.
Why use it?
Maintain consistent data formatting and avoid overly long inputs that could break forms or reports.
How to Add this Rule
- In your form: Go to the Logic tab and click + Add a Rule.
- Set the Condition: Choose None or a condition to activate the check.
- Add the Step: Drag Execute JS and paste the code below.
- Click Save
let number = (getValue('FullPostalAddressOfOrganisation')||"").length; if (number) { if (number > 10) { setErrorMessage("FullPostalAddressOfOrganisation", "The max characters is 10"); } }
8. Limit Date to 14 Days from Today
This rule ensures a selected date is not more than 14 days from the current date.
Why use it?
Control scheduling or authorisation windows and Prevent users from entering far-future dates.How to Add this Rule
- In your form: Go to the Logic tab and click + Add a Rule.
- Set the Condition: None
- Add the Step: Drag Execute JS and paste:
- Click Save
let givenDate = moment(getValue("ChosenDate"), 'YYYY-MM-DD'); let today = moment(); if (givenDate && givenDate.isAfter(moment(today).add(14, 'days'))) { setErrorMessage("ChosenDate", "The date can't be more than 14 days from today."); }
9. Comparing Dates
This rule calculates the difference between two dates and can be used to automatically set the number of days between them. It’s useful for reporting, scheduling, or tracking durations.
Why use it?
Automatically calculate durations for tasks, bookings, or leave requests. Ensure accurate reporting without manual calculation.
How to Add this Rule
- In your form: Go to the Logic tab and click + Add a Rule.
- Set the Condition: Choose None or a custom condition if needed.
- Add the Step: Drag Execute JS and paste the code below
- Click Save
let days = moment(getValue('Date1')).diff(moment(getValue('Date2')), 'days') + 1; setField('days', days);
10. Validating Email Fields
This rule ensures an email field is correctly formatted and not empty. It’s useful for avoiding invalid email submissions that could break automated notifications or communications.
Why use it?
Ensure submitted emails are valid before sending notifications and Improve data accuracy.
How to Add this Rule
- In your form: Go to the Logic tab and click + Add a Rule.
- Set the Condition: Choose Custom JS function and paste:
const fieldValue = getValue("EMail") ?? ""; !fieldValue.match(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.[a-zA-Z]{2,})$/);
- Add the Step: Drag Field – Set Custom Error to the Steps section.
Field:EMail and Error message: “Please enter a valid email address”- Click Save
11. After-Save Scripts – Auto-Set Form Title
After-save scripts run once the form is saved and can automatically generate a title or reference number. This is useful for keeping forms organised or assigning unique identifiers.
This is done within the settings panel – After-Save Script
Why use it?
Automatically generate unique titles for new submissions and keep numbering consistent without manual input.
Example 1: 5-digit number padding
let id = “00000” + getValue(“ID”); setValue(“Title”, id.substr(id.length -5));
Example 2: 6-digit number with prefix
var counter = ‘000000’ + getValue(‘ID’); var acro = ‘CCM’; var newID = acro + counter.substr(counter.length-6,6); setValue(‘Title’, newID);
Example 3: 5-digit number with prefix and offset
var counter = ‘00000’.concat((getValue(‘ID’)*1) – 24); var acro = ‘MBF-‘; var newID = acro.concat(counter.substr(counter.length-5,5)); setValue(‘Title’, newID);
Example 4: Only set title if not already set
let oldTitle = getValue(“Title”); var idValue = getValue(‘ID’); var counter = idValue.toString().padStart(6, ‘0’); var acro = ‘FE-‘; var newID = acro + counter; if (oldTitle != newID){ setValue(‘Title’, newID); }







