0

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?

39replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • 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

    Like
    • Tom De Ryck
    • allora Factory
    • Tom_De_Ryck
    • 2 yrs ago
    • Reported - view

    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.

    Like
    • Nick
    • Nick
    • 2 yrs ago
    • Reported - view

    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.

    Like
    • Tom De Ryck
    • allora Factory
    • Tom_De_Ryck
    • 2 yrs ago
    • Reported - view

    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.

    Like
    • Nick
    • Nick
    • 2 yrs ago
    • Reported - view

    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:

    shot

    Like
    • Tom De Ryck
    • allora Factory
    • Tom_De_Ryck
    • 2 yrs ago
    • Reported - view

    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.

    Like
    • Mconneen
    • Mconneen
    • 2 yrs ago
    • Reported - view

    @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. :( 

    Like
  • 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

    Like
    • E.T.
    • SECOS Group
    • quartz_cap
    • 2 yrs ago
    • Reported - view

    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?

    Like
    • Nick
    • Nick
    • 2 yrs ago
    • Reported - view

    What's the point of this?

    A user can close the form by hitting 'Esc' key or navigate to a different record.

    Like
  • 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.

    Like
    • Mconneen
    • Mconneen
    • 2 yrs ago
    • Reported - view

    @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. 

    Like
    • Sean
    • Sean
    • 2 yrs ago
    • Reported - view

    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.

    Like
    • Mconneen
    • Mconneen
    • 2 yrs ago
    • Reported - view

    @Sean... interesting strategy.. I like it. 

    Like
    • Sean
    • Sean
    • 2 yrs ago
    • Reported - view

    @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.

    Like
    • Nick
    • Nick
    • 2 yrs ago
    • Reported - view

    Idea 💡

    If we found a trick to hide the 3 toolbar buttons: Delete, Duplicate and Create?

    Like
    • Sean
    • Sean
    • 2 yrs ago
    • Reported - view

    @Nick, Yes, we just need the name/names of those elements and then use the html() approach to hide/disable them.

    Like
  • 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...

    Like
    • Sean
    • Sean
    • 2 yrs ago
    • Reported - view

    @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.

    Like
  • @Sean, does this address the Esc button?

    Like
    • Nick
    • Nick
    • 2 yrs ago
    • Reported - view

    @Sean,

    You did your magic again 👍👍👍

     

    Thanks

    Like
    • Sean
    • Sean
    • 2 yrs ago
    • Reported - view

    @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?

    Like
  • come si accede ai database dei webinar?

    Like
  • Ciao Antonello, 

    Ora ti ho invitato a far parte del team Ninox Webinar EN 19.

    Saluti, Jörg

    Like
  • @sean, not that I am aware of

    Like
Like Follow
  • 1 yr agoLast active
  • 39Replies
  • 8182Views