0

Alert message on CloseRecord

Hi guys,

i want Ninox to check that a certain field is not null when closing the record and alert me if it is the case.

 

if Type = null then
alert("Remember to fill in the *Type* field")
end

 

it works when executed by a button - but where do I place the string for it to work when I attempt to close the record ?

 

Have tried Trigger after update on the form itself - but nothing happens

 

thanks, John :) 

15 replies

null
    • Mel_Charles
    • 2 yrs ago
    • Reported - view

    Hi John

    I have tried this but I agree it won't trigger, you could add a formula field onto the form and put that script in it.

    but of course it will then nag you to death (even on a new record) so not ideal - but at least it will tell you!

    Will setting the field to 'required' do? as this will at least prompt you on the field itself - but I agree it will still not stop you from saving the record 

    • Ninox partner
    • RoSoft_Steven.1
    • 2 yrs ago
    • Reported - view

    Use the trigger after hide setting of the TAB element.(If you don't have a tab element, create one and place it on first position of the fields in the column)

    something like :

    let me := this;
    if not Type then
    let responce := dialog("Warning !", " The type field is empty, delete this record?", ["Yes", "No"]);
    if responce = "Yes" then
    delete me
    else
    if responce = "No" then popupRecord(me) end
    end
    end

     

    Steven

    • Mel_Charles
    • 2 yrs ago
    • Reported - view

    Oh Steven - Learn something every time from you. I never knew you could put scripts directly against a tab property!!

    Tried it and works perfectly !!! Not only does it fix John's issue but I can so use this feature !!

    Steven you are a "Steely Eyed Missile Man" :-)

    Mel

    • KAXIG ApS
    • John.1
    • 2 yrs ago
    • Reported - view

    Mel: I think I'll suggest to Ninox, that a required field should work in a way, that would not allow you to close the record without setting a value - just like on any web-site form out there :)

     

    and Steven: excellent! I tweaked it a bit since I dont want the record to be deleted - but it works like a clock, and have been added to my own "Valuable Ninox coding strings" library :)

     

    Thanks guys !!

    • KAXIG ApS
    • John.1
    • 2 yrs ago
    • Reported - view

    Just a little thing:

     

    when I use this string on the tab, and then delete the record - the Warning will still ask if I want to set the value

     

    let me := this;
    if not Type then
    let responce := dialog("Warning !", " The type field is empty. Want to set a value now?", ["Yes", "No"]);
    if responce = "Yes" then
    popupRecord(me)
    else
    if responce = "No" then closeRecord() end
    end
    end

     

    Is there a way to discard the command in case of deleting the record ?

    J-)

    • Ninox partner
    • RoSoft_Steven.1
    • 2 yrs ago
    • Reported - view

    John,

    Deleting the record is the same as leaving the TAB so it checks if the required field is present. If the case is that Type-field is empty then you also get the warning.

    Solution can be assigning a random value to the Type-field before deleting.

    Maybe adding a extra designated button instead of using the bin-icon for deleting the record like:

    Type := 1;

    delete(this)

     

    Steven

    • Mel_Charles
    • 2 yrs ago
    • Reported - view

    John - Good luck with that _ I've lost count of the number of times I have asked Ninox to made a required field do what it is supposed to do. (ie nt let you save the form untill you fill in that field)

    as well as asking for :-

    a proper sequencial auto number!

    numeric string fields

    a timer - for events controls

    The ability to add scripts to a form etc (that are not tied to - on open/after data mod)

    Better handing of print design (especially on child table control)

    plus others but...

    Most important do something with this forum! (it is woefully behind others out there)

    See .... I'm starting to rant and that is not good for mt ticker!

    • KAXIG ApS
    • John.1
    • 2 yrs ago
    • Reported - view

    Steven, Thanks for explaining, I think I'll go with the button, and build some additional automation :)

     

    Mel, I get what you say - the things you have been asking for will benefit most of the Ninox users, which makes the unwillingnes a mystery. I sometimes wonder if they have stopped developing - or perhaps they are working on a new revolutionary version???  and then again,,,,, nahhh :)))))

    My wife is a front-end IT-supporter on a somewhat similar type of platform, serving huge loads of smaller customers - and it seems to me that when these companies get to a certain size (having enough of customers), they very often stop caring too much about the individual customers since they are replaceable - and from the customers pov, most times changing vendor is more difficult than to accept the current struggle - so we stay... due to lack of alternatives (since they are all the same)

    It's sad, but also very "standard"... 

     

    J-)

    • KAXIG ApS
    • John.1
    • 2 yrs ago
    • Reported - view

    Steven,

    I made the button, as you suggested, but the strange thing is, that I can actually physically see that the TYPE field value is being set to "1", before deleting the record - then the record is being deleted - but still the Warning pops up asking if I want to set the value in the TYPE field - strange ?

    J-)

    • Ninox partner
    • RoSoft_Steven.1
    • 2 yrs ago
    • Reported - view

    Strange. And if you manually set a Type value first and then use the bin icon(not the button), does it still popup? If not i guess the setting of the type is happenig on the server and deletion is local(or the other way around). What you can do then is add a pause between the two codelines in your button:

    Type:= 1;

    sleep(2000);

    delete(this)

    Steven

    • KAXIG ApS
    • John.1
    • 2 yrs ago
    • Reported - view

    Yeah - that's what I thought about too - somehow "pause" the process. I've tried the sleep-trick now, but the result is still the same. (instead of "sleep" there should perhaps be some kind of "updateRecord"?)

    Anyway, it's not very often that I find myself deleting these records - and after all, the REAL problem is that Ninox's required fields doesn't do, what required fields are supposed to do - securing the result (as it is, it's only a gentle reminder - pretty pointless if you ask me).

    So don't waste more time on this.

    Thanks for your effort, and have a nice weekend ☀️

    J-)

    • KAXIG ApS
    • John.1
    • 2 yrs ago
    • Reported - view

    Steven, I completely forgot to answer your question - it actually does behave the same way if I set the TYPE field value manually, and the delete using the bin-button :-/

    J-)

    • Ninox partner
    • RoSoft_Steven.1
    • 2 yrs ago
    • Reported - view

    John,

    I tried to replicate it and I have the same strange behavior. This must be a bug, I will forward it to support.

    And yes, the updates are sometimes unpredictable but always innovative when there are major updates... Besides that, I still love Ninox.

    Steven

    • KAXIG ApS
    • John.1
    • 2 yrs ago
    • Reported - view

    Well - just like in a marriage, we can all experience difficulties - without loosing the love 

    With that said, one DO have to speak up to improve things :)

    J-)

    • Mel_Charles
    • 2 yrs ago
    • Reported - view

    John

    2 things  :-

    1. I too love Ninox - it is great software but I agree you have to voice some stuff!

    2. What does it take to get your wife onto user supporting the front end of Ninox then ? 😘

Content aside

  • 2 yrs agoLast active
  • 15Replies
  • 576Views