show fields and hide fields with checkbox

hello, I want to show on screen 2 fields when my checkbox is checked, and when the checkbox is unchecked dont show the fields on screen.
what’s the best way to do this, thanks.
I uploaded a picture for reference.

checkbox.png

Hey Israel, you can use the sc_field_display({My_Field}, on/off) macro of scriptcase

Create an ajax event for the checkbox as onChange then use the sc_field_display macro to show or hide the files as you want to.
Hope this is of help.

Regards

hey kafecadm, I used this code

if ({chkmask} == '0')     // Display field
{
    sc_field_display({patient}, 'on');
}
else      // Hide field
{
    sc_field_display({patient}, 'off');
}

“chkmask = name of my checkbox, patient = the name of the field”

the field only dissapears from mi screen but dont shows again, any tips to improve this code. thanks a lot.

[QUOTE=israel lopez;30983]hey kafecadm, I used this code

if ({chkmask} == '0')     // Display field
{
    sc_field_display({patient}, 'on');
}
else      // Hide field
{
    sc_field_display({patient}, 'off');
}

“chkmask = name of my checkbox, patient = the name of the field”

the field only dissapears from mi screen but dont shows again, any tips to improve this code. thanks a lot.[/QUOTE]

How has you defined your checkbox? Probably it hasn’t defined and unchecked value. By default, and unchecked checkbox hasn’t value. Put 0 as default value and try again.