JSP:
<input type='hidden'
id='<bean:write name="academicGoalLevel" property="contentId1" />'
name='<bean:write name="academicGoalLevel" property="contentId1" />'
value='<bean:write name="academicGoalLevel" property="activity1" />'
/>
JavaScript:
// id is 30 only
var x = document.getElementById('30').value;
alert(x);
if (x.length != 0) {
alert("Please Enter a School Year 1");
return false;
}
The first time I go to the page and enter the data in text field I'm not able to get the value in JavaScript.
When I come a second time I get the hidden fields.
How can I resolve this?