Important Update: Community URLs redirect issues are partially resolved. Learn More. .

cancel
Showing results for 
Search instead for 
Did you mean: 

Hide the text fields based on value list selection through custom code in sub-form

Anonymous
Not applicable

Hi  All,

Could any one have an idea on how to hide the at least two text fields in View mode and Edit mode based on the value list through custom code in sub-form

 

Example: 1.If I select value-list field as firewall then two text fields should be display.( Both in Edit mode and View Mode)

                 2.If I select value-list field as router then two text fields should be hide.( Both in Edit mode and View Mode)

                 3.If I select value-list field as switch then two text fields should be hide.( Both in Edit mode and View Mode)

The below code I have tried but in edit mode it is working but in view mode the data is not hiding and other issue is like in view mode I am able to hide only single text field but multiple text field is not working in view mode.

<script type = "text/javascript" >

Sys.Application.add_load(function(){

var f=document.querySelectorAll("[data-valueslistvalueid='152555']")[0].innerText;

var r=document.querySelectorAll("[data-valueslistvalueid='152556']")[0].innerText;

var s=document.querySelectorAll("[data-valueslistvalueid='152557']")[0].innerText;

if (f=='firewall')

{

document.getElementById("master_DefaultContent_rts_s8338_f23155c").style.display='block';

document.getElementById("master_DefaultContent_rts_s8338_f23154c").style.display='block';

}

else if (r=='router')

{

document.getElementById("master_DefaultContent_rts_s8338_f23155c").style.display='none';

document.getElementById("master_DefaultContent_rts_s8338_f23154c").style.display='none';

}

else if (s=='switch')

{

document.getElementById("master_DefaultContent_rts_s8338_f23155c").style.display='none';

document.getElementById("master_DefaultContent_rts_s8338_f23154c").style.display='none';

}

});

</script>

I have chosen the custom code because in sub-form we cannot use  DDE. . I would like to request from any one of you to provide the solution for this.

0 REPLIES 0