Hiding mandatory fields..

gaz624
Mega Contributor

Hi, I'm looking to not display some mandatory fields in certain scenarios. I will fill them with "n/a" just so that the form can be submitted.

I've tried this with a non-mandatory field an it has worked ok.                  

function onLoad() {

          If (matches conditions){

                    g_form.setDisplay('description', false);     //works

                    g_form.setDisplay('u_what_are_the_benefits_of_imp',false);   //doesn't work

            }

}

But when trying the same with some other fields its not working. I'm guessing because they are mandatory?

Is there a way around this?

Thanks

1 ACCEPTED SOLUTION

Anurag Tripathi
Mega Patron
Mega Patron

If there is a mandatory field you cant make it read only or hide it, so before you have to hide you make the field non mandatory.



Similarly, if a field is read only you cant make it mandatory, you first need to make it editable n then make it mandatory.


-Anurag

View solution in original post

16 REPLIES 16

Hello Meena,



If you are using a client script it should fire onChange of a field. So if for example the field changes to particular value and you want another mandatory field to be no longer visible is to have the following code:



g_form.setMandatory('YOUR FIELD HERE',false);


g_form.setVisible('YOUR FIELD HERE',false);



Please note that even if you set a field to visible false, if it is mandatory the mandatory policy will make it visible again. So it is imperative that you first remove the mandatory using the first line and theb set visible to false after that line of code.


google1
Kilo Contributor

Hello ETI,



Please could you send me a screen shot of the client script so that I could know how to remove the mandatory field.


find_real_file.png


google1
Kilo Contributor

hello ETI,



I do not have Call(new_call) in the table field. What is the other option I can choose from the fields in the table section.


That is an example. The table should be the table you are using the client script for and the Field name should be the field you are changing the value to trigger the script. For example you have the incident form and on changing the value of field "A" triggers the script. So the Table field should be Incident and the Field Name should be "A". In the script, the part where you have 'name of field here' is to be replaced by the name of the field you want to remove from being mandatory and hide.