Button to validate required fields
Is there a formula to insert in a button that makes me the automatic validation of all required fields displayed in the mask including embedded tables or do I have to make a script on purpose? It is very important to me that all required mandatory items are entered
2 replies
- 
  You would have to write the script yourself. I am unsure what you want to happen. If field Text1 is empty and you click the button what do you want to happen? 
- 
  This is a consequence of the way Ninox is designed. Fields can be marked as "Required" but there is no way of using that information in a trigger, as far as I know. Records are created immediately with blank fields which are then filled with data (or not), rather than the fields validated for being "Required" before allowing a record to be created. There are various way you could handle this: Create a formula field called, say, "Validated" with script that says something like: if field1 = null or field2 = null or field3 = null or fieldx = null then 
 "No"
 else
 "Yes"
 endThis will create a new field "Validated" that either says "Yes" (required fields are all entered) or "No" (some required fields are blank). Obviously, change the script to suit your own validation criteria - doesn't have to be just checking for a null value. Then add a View called "Unvalidated Records" to the main table filtered by Validated="No" so that you only see records with a problem. Or, if you use tabs on your record you could add a "Trigger after hide" to show an alert or keep the record open: if Validated = "No" then alert("Required Fields Missing") end; or if Validated = "No" then openRecord(this) end; Not ideal solutions but might give you ideas! 
Content aside
- 3 yrs agoLast active
- 2Replies
- 146Views
- 
    3
    Following
    
