Is there a way to enforce the required fields so a record row will not be added unless all required fields are completed?
Is there a way to enforce the required fields so a record row will not be added unless all required fields are completed?
39 replies
-
Hi, that is not possible, as records are created on instance.
Though we have this thought already on the change request list.
Best regards, Alex
-
This would be great if it could be added. Because now people can add records without filling all required fields. And that's why we make them required, because they need to be filled in otherwise there are later on issues.
-
Alternatively you can use some logig steps (this is not the same but you 'll get warning), for example
---
let t := this;
if RequiredField = null then
let check := dialog("Attention", "This Field can not be empty bla bla bla", ["OK", "Delete"]);
if check = "Delete" then delete this end
end---
*If you press "Delete" will delete the record.
-
Hi Nick,
And this dialog works? I don't get this dialog at record or field update. Or am I doing it wrong (you are talking with a beginner here ;-))?
If I replace what's between the if statement with an alert, the alert will pop-up.
Thx.
-
Hi Tom,
yes it works, if you put the code behind a button.
When done with the creation or modification of a record, push the (e.g. 'Save') button and:
-
Hi Nick,
Ok, I understand. It's working now :-)
But if I'm correct, in theory you are not really saving it when pressing the button. It's more like a check. So there is still a way of adding records with empty RequiredFields.
So not really what I was hoping to do but it was a good learning on triggers :-)
Thx.
-
@Tom,
That is correct.. Ninox Partner Maarten Thiebou presented an interesting "hack"... It is a way to use html / css to "hide" the "X" in the upper left, and add a button to save/close.. where you can put the logic. That said.. users can still move off the table, or simply close the application and add invalid data. :(
-
crea un campo formula e scrivi al suo interno:
html("
<style>
.sideeditor-buttons-left .button{
display: none;
}
</style>
")Vedrai scomparire la "X" per chiudere il modulo.
Crea successivamente un tasto "Salva e chiudi" per fare tutti i controlli prima di uscire
-
Could the formula solution provided by Antonello be used globally? And used to style the entire database?
Wondering if that would cause issues with the speed of the database?
-
What's the point of this?
A user can close the form by hitting 'Esc' key or navigate to a different record.
-
Nick dice una cosa giusta, però ad oggi altre soluzioni non ci sono. Purtroppo nel mio caso ho bisogno che alcuni moduli vengano compilati in modo corretto e non lasciati vuoti . Invito il team di Ninox a prendere in considerazione questa modifica, come già sollecitato più volte.
-
@Sarah
Antonello code will only work for the main form. You need the following for the subsequent pop up forms:
html("<style> .popupeditor2-buttons-left .button { display: none; } </style> ")
I have observed no noticable impacts on "speed" of the database.
Note.. The user could still navigate off the record, close the table or database (etc) and the data would still be empty.
-
Another possible workaround would be to create a separate table that matches the table you are adding records to. In Nick's example there is a "Save" button. In this workaround you would add an "Add Record" button and use
popupRecord()
to call the separate table form. You can then do all the input validation you want and a new record would only be added to the main table once "Save" is clicked on the subform.Of course, there isn't anything preventing the user from clicking the "+" to add a record.
-
@Sean... interesting strategy.. I like it.
-
@Mconneen, I remember reading about that approach in Alan Simpson's book "Understanding dBASE IV" almost 30 years ago, LOL. If I recall correctly, it was characterized as... "There is a school of thought that you shouldn't add records directly to the database". It's not one that I implemented at the time though.
-
Idea
If we found a trick to hide the 3 toolbar buttons: Delete, Duplicate and Create?
-
@Nick, Yes, we just need the name/names of those elements and then use the
html()
approach to hide/disable them. -
While all these approaches are great, it feels like we're trying to "stand on our heads" and doing cartwheels for something that should be fairly straightforward and as Sean elluded to that writing to this database should not be done directly. It's seems almost worth the time, instead of hacking, to just use the Ninox API in order to access the DB and create one's own interface to limit the user's ability to save. Just my two cents...
-
@Nick, one trick is this...
html("
<style>
.hud-menu-button.menu-icon.menu-icon-trash{display: none;}
.hud-menu-button.menu-icon.menu-icon-duplicate{display: none;}
.hud-menu-button.menu-icon.menu-icon-add{display: none;}
</style>
")
The problem is it only works when a Form view is present and there's nothing you can do about the menu options in the apps. I posted a database named NoEmptyFieldsOrRecords, a bit of a misnomer, on the Webinar page that demonstrates the workaround. Feel free to add and edit records. Obviously, the Contacts Add and Contacts Edit tables would be hidden as well as the formula field.
-
@Sean, does this address the Esc button?
-
@Sean,
You did your magic again
Thanks
-
@mnash, I think this approach makes the Esc button irrelevant. A new record is not added until all input validation is satisfied and the user clicks the custom Save button. Do you have access to the Webinar databases?
-
come si accede ai database dei webinar?
-
Ciao Antonello,
Ora ti ho invitato a far parte del team Ninox Webinar EN 19.
Saluti, Jörg
-
@sean, not that I am aware of
Content aside
- 3 yrs agoLast active
- 39Replies
- 8683Views