You need to sign in to do that
Don't have an account?

Uncaught TypeError: Cannot read property 'style' of null
I am trying to show the field based on onclick of the radio button.
Id is coming and not able to display it and facing the Uncaught TypeError: Cannot read property 'style' of null error.
<script type="text/javascript">
function Disablefilter(var1){
alert(var1)//id is showing in alert.
document.getElementById(var1).style.display=display;
}
let me know where i am missing the logic.Suggest me how to enable the field onclick of radio button using javascript.
</script>
Id is coming and not able to display it and facing the Uncaught TypeError: Cannot read property 'style' of null error.
<script type="text/javascript">
function Disablefilter(var1){
alert(var1)//id is showing in alert.
document.getElementById(var1).style.display=display;
}
let me know where i am missing the logic.Suggest me how to enable the field onclick of radio button using javascript.
</script>
I suppose you are writing VFPage.
Then something like below will work.
Thanks and Regards
sandhya
All Answers
The valid options for display are "block", "inline", "none", "table", etc...
Please replace your code
document.getElementById(var1).style.display=display;
with
document.getElementById(var1).style.display='block';
Please accept my solution as Best Answer if my reply was helpful. It will make it available for other as the proper solution. If you felt I went above and beyond, you can give me kudos.
Thanks and Regards
Sandhya
I have modified but still facing the same error.
Suggest me if there are any challenges here.
please refer below code which works in the same way. Hope this will help you.
Thanks and Regards
sandhya.
Here is a working example with Radio button. On load the input field is disabled when you click on radio button the input field will enable.
VFPage
-----------
Controller
----------------
Please accept my solution as Best Answer if my reply was helpful. It will make it available for other as the proper solution. If you felt I went above and beyond, you can give me kudos.
Thanks and Regards
Sandhya
This example will work to disable the field on click of the button but not show the field.
More over it will work based on controller response ,but I m trying to approach with client side
Iike JavaScript event not with actionsupport.
Thanks for your references.
I suppose you are writing VFPage.
Then something like below will work.
Thanks and Regards
sandhya
I appreciate your response.
I appreciate your response.