Adding empty value even if is mandatory.

Hello I have mobile app where I can add extra info about boxes. And this extra value is mandatory (it can be 0). If user do not enter this value is ok cause program says its mandatory. But the issue is where user enter some value (not send it) and deletes it and then send (with nothing inside) the program is adding box with extra info as "0". Somtimes user can just deletes it and send and now its a bad thing. I know user can fix it by edit, but I dont want it to send with zero when user deletes value. Hope u know what I mean.

Hello,

Can you have a look on this post?

https://www.outsystems.com/forums/discussion/26154/form-validation-on-mobile/

I think it will help you.


BR,

Luis


Roksana Jachymczyk wrote:

Hello I have mobile app where I can add extra info about boxes. And this extra value is mandatory (it can be 0). If user do not enter this value is ok cause program says its mandatory. But the issue is where user enter some value (not send it) and deletes it and then send (with nothing inside) the program is adding box with extra info as "0". Somtimes user can just deletes it and send and now its a bad thing. I know user can fix it by edit, but I dont want it to send with zero when user deletes value. Hope u know what I mean.



Hi Roksana,

If I understand your problem you wan to keep your input value to default 0 even if user deletes the default value.

If that is the case, then you can create an onchange event on the input and in this action check if input is blank then set it to 0. I hope this is what you were looking for.

Hi Roksana,


Could you please share oml


Nikhil Gaur wrote:

Hi Roksana,

If I understand your problem you wan to keep your input value to default 0 even if user deletes the default value.

If that is the case, then you can create an onchange event on the input and in this action check if input is blank then set it to 0. I hope this is what you were looking for.


Hello, I will try explain it how I can :) but I see we are on the right path :)

When user delete value and by accident send it I dont want to program set value "0" as default, cause user acctualy didnt set the value (is empty) I want it to create message "set the value, it cant be empty" and user must set value, it can be 0 or 100, no matter.


Where you have set this value as mendatory? If this is set on your entity attribute then on submit you just have to check FormName.Valid and it will automatically show mendatory message if value is blank. 

But if this is not set to mendatory in your entity attribute you should check using if condition and if it is blank then set Valid property of your input to false and also set validation message like below.

Solution

Hello Roksana, 

I don´t know what the user have to do to "send" the values but if a mandatory field is empty when the the user sends the information to the server through a button or a link it always says it's an error because the field id mandatory. But if you are using an "on change" event the validation is not done. 

In the case you are using "on change" you must do the validation in the action used and that is a "little painful".

Regards

Graça

Solution

Thank all of you. This action OnChange just ruined everything :D

Thank you :)

Good to hear that you got the solution :)