Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy this javascript not enabling text boxes using check box?
    text
    copied!<p>Again in problem Actually I have following jsp code in which I have few text boxes which I have made disabled by using property disabled="disabled". Now problem is each record that I will get from database in each text box using iterator which iterates values added from databse in arraylist.If database return more than one record then using that check box I can enable textboxes but if databse resultset return only one record then I am unable to enable textboxes and throws following ERROR: Message: 'document.f1.chk' is null or not an object Line: 26 Char: 10 Code: 0</p> <pre><code>&lt;script type="text/javascript"&gt; function enable() { for(i=0;i&lt;document.preapp.chk.length;i++) { if(document.preapp.chk[i].checked==true) { document.preapp.id[i].disabled=false; document.preapp.vname[i].disabled=false; document.preapp.comp[i].disabled=false; document.preapp.cont[i].disabled=false; document.preapp.wtm[i].disabled=false; document.preapp.intime[i].disabled=false; } else if(document.preapp.chk[i].checked==false) { document.preapp.id[i].disabled=true; document.preapp.vname[i].disabled=true; document.preapp.comp[i].disabled=true; document.preapp.cont[i].disabled=true; document.preapp.wtm[i].disabled=true; document.preapp.intime[i].disabled=true; } } } &lt;/script&gt; &lt;CENTER&gt;&lt;a href="../vm/form.jsp "&gt;Back to Search&lt;/a&gt;&lt;/CENTER&gt; &lt;form method="post" action="" name="preapp"&gt; &lt;table border="1" align="center" width="100%"&gt; &lt;% Iterator itr; try { ArrayList al=(ArrayList)request.getAttribute("sq"); int i=0; for(itr=al.iterator();itr.hasNext();) { i=i+1; %&gt; &lt;tr&gt; &lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;input type="checkbox" name="chk" onclick="enable(this)" &gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;Id&lt;/td&gt;&lt;td&gt;&lt;input type="text" name="id" value="&lt;%=itr.next()%&gt;" disabled="disabled" size="100%"&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;Visitor Name&lt;/td&gt;&lt;td&gt;&lt;input type="text" name="vname" value="&lt;%=itr.next()%&gt;" disabled="disabled" size="100%"&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;Comapny&lt;/td&gt;&lt;td&gt;&lt;input type="text" name="comp" value="&lt;%=itr.next()%&gt;" disabled="disabled" size="100%"&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;Contact&lt;/td&gt;&lt;td&gt;&lt;input type="text" name="cont" value="&lt;%=itr.next()%&gt;" disabled="disabled" size="100%"&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;Meeting Scheduled With&lt;/td&gt;&lt;td&gt;&lt;input type="text" name="wtm" value="&lt;%=itr.next()%&gt;" disabled="disabled" size="100%"&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;Entry Made On&lt;/td&gt;&lt;td&gt;&lt;input type="text" name="intime" value="&lt;%=itr.next()%&gt;" disabled="disabled" size="100%"&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;/tr&gt; &lt;% } } catch(Exception e) { e.printStackTrace(); System.out.println(e.getMessage()); } %&gt; </code></pre> <p>How Do solve this problem? please help me out!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload