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?

39 replies

null
    • Alexander_Koenig
    • 5 yrs ago
    • Reported - view

    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

    • allora Factory
    • Tom_De_Ryck
    • 4 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.

    • Nick
    • 4 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.

    • allora Factory
    • Tom_De_Ryck
    • 4 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.

    • Nick
    • 4 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

    • allora Factory
    • Tom_De_Ryck
    • 4 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.

    • Mconneen
    • 4 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. :( 

    • Antonello_Stabile_71
    • 4 yrs ago
    • Reported - view

    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

    • SECOS Group
    • quartz_cap
    • 4 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?

    • Nick
    • 4 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.

    • Antonello_Stabile_71
    • 4 yrs ago
    • Reported - view

    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.

    • Mconneen
    • 4 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. 

    • Sean
    • 4 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.

    • Mconneen
    • 4 yrs ago
    • Reported - view

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

    • Sean
    • 4 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.

    • Nick
    • 4 yrs ago
    • Reported - view

    Idea 💡

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

    • Sean
    • 4 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.

    • dsnyrecordsmanagement
    • 4 yrs ago
    • Reported - view

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

    • Sean
    • 4 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.

    • dsnyrecordsmanagement
    • 4 yrs ago
    • Reported - view

    @Sean, does this address the Esc button?

    • Nick
    • 4 yrs ago
    • Reported - view

    @Sean,

    You did your magic again 👍👍👍

     

    Thanks

    • Sean
    • 4 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?

    • Antonello_Stabile_71
    • 4 yrs ago
    • Reported - view

    come si accede ai database dei webinar?

    • Jorg
    • 4 yrs ago
    • Reported - view

    Ciao Antonello, 

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

    Saluti, Jörg

    • dsnyrecordsmanagement
    • 4 yrs ago
    • Reported - view

    @sean, not that I am aware of

Content aside

  • 3 yrs agoLast active
  • 39Replies
  • 8711Views