You need to sign in to do that
Don't have an account?
vanessa veron
Message error Javascript
Hello I'm using JS to create error messages when a field is blank ...
This works for InputText:
To CHECK BOX and SELECT OPTION does not work.
Why????
Thank you!!!!
This works for InputText:
if(document.getElementById("{!$Component.theform.block01.nomJobIP}").value == "" || document.getElementById("{!$Component.theform.block01.mailIP}").value == "" || document.getElementById("{!$Component.theform.block01.nomJobIP}").value == "") { alert("messsage"); }
To CHECK BOX and SELECT OPTION does not work.
Why????
if(document.getElementById("{!$Component.theform.block01.ckLun}").checked == false && document.getElementById("{!$Component.theform.block01.ckMar}").checked == false && document.getElementById("{!$Component.theform.block01.ckMer}").checked == false && document.getElementById("{!$Component.theform.block01.ckJeu}").checked == false && document.getElementById("{!$Component.theform.block01.ckVen}").checked == false && document.getElementById("{!$Component.theform.block01.ckSam}").checked == false && document.getElementById("{!$Component.theform.block01.ckDim}").checked== false ){ alert("messsage"); }
var aa = document.getElementById("{!$Component.theform.block01.selMoisFreqSem}").value; var bb = document.getElementById("{!$Component.theform.block01.selMoisFreq}").value; if(aa == '' && bb == '' || aa == null && bb == null) { alert("select NULL"); }
Thank you!!!!
I think you might need to convert the element to a checkbox and then evaluate the checked property of the checkbox.
I could be wrong here though
Vish
Seems you need to check your Javascript conditions, specifically this one
It could be
For the checkboxes you use AND, so it should be triggered only when all checkboxes are unchecked.
I have checkbox for each day of the week and I have too the selectList for the periods.
I like to check with JS if the checkboxes are DISABLE, an error message appears ...
I can not check if my checkbox are DISABLE and if my selectList are DISABLE.
Somebody help me!
Thank you