Page 1 of 1

Require a field in certain circumstances

Posted: Sat Oct 10, 2015 2:22 am
by CreationX
I have two fields when browsing to edit form that I need to require (not be blank) only under certain circumstances.

For example, I have 5 fields, A, B, C, D, E. D and E are only required to be filled out if A meets a certain criteria for example.

I was using the display condition, IF A = 1, display D and E, however it threw an error on all conditions where A != 1, because even though the field was hidden, it was requiring it to be filled out anyway.

So, what I am asking is, how can I set conditional required (non-blank) fields?

Re: Require a field in certain circumstances

Posted: Mon Oct 12, 2015 1:22 am
by CreationX
bump

Re: Require a field in certain circumstances

Posted: Mon Oct 12, 2015 1:34 am
by admin
CreationX,

You will need to set these fields to Can Be Left Blank and validate these things at the point of saving using nuOnSave() http://wiki.nubuilder.net/nubuilderv3/i ... Save.28.29.

You may also find that using nuEnable() and nuDisble() http://wiki.nubuilder.net/nubuilderv3/i ... C_value.29.

It won't hide the field but along with disabling it, it can also reset its value. And it will know if the field is a Text, Lookup etc.

Steven

Re: Require a field in certain circumstances

Posted: Mon Oct 12, 2015 5:50 pm
by CreationX
Thank you, I am trying to do this with limited JavaScript knowledge.

I am also having a problem with dropdowns not selecting a default value when using static values (ex. 1|Yes|2|Maybe|3|No)

It comes up blank on edit form.

Re: Require a field in certain circumstances

Posted: Tue Oct 13, 2015 12:13 am
by admin
CreationX,

Setting a default is done with SQL..
Capture.PNG
Steven

Re: Require a field in certain circumstances

Posted: Tue Oct 13, 2015 2:29 pm
by CreationX
Yes, unfortunately I have tried that.

Re: Require a field in certain circumstances

Posted: Wed Oct 14, 2015 12:03 am
by admin
Can you get the Default to work on a Text Object?

Steven

Re: Require a field in certain circumstances

Posted: Wed Oct 14, 2015 3:26 am
by CreationX
admin wrote:Can you get the Default to work on a Text Object?

Steven
Yeah, default works great on a text object.

Re: Require a field in certain circumstances

Posted: Wed Oct 14, 2015 8:36 am
by admin
Can you do a screen dump of the Default SQL and the list in SQL and share it here?

Steven