• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problems to hide div

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I can't hide a div that I have on my jsp...I think the problem may be that there is java code inside...any suggestions???

<div id="createDiv" class="hidden">
<c:if test="${canCreate}">
<tr>
<%for(int j=0;j<listColumns.size();j++){
pageColumns=(PageColumns)listColumns.get(j);

if(pageColumns.getType()=="input"){
%>

<td><input type="text" name="create_<%=pageColumns.getName()%>" /></td>
<%}
if(pageColumns.getType()=="checkbox"){
System.err.println("property ");
%>

<td>& lt;input type="checkbox" name="create_<%=pageColumns.getName()%>"/></td>
<%}
if(pageColumns.getType()=="list")
{
%>
<td>& lt;select id="create_<%=pageColumns.getName()%>" name="create_<%=pageColumns.getName()%>" multiple="multiple" size="5">
<logic:iterate name="CallerId" id="CallerId">
<option value="<bean:write name='CallerId' property='name' />">
<bean:write name="CallerId" property="callerid"/>
</option>
</logic:iterate>
</select>
</td>
<%
}
}
%>

</tr>
</c:if>
</div>


this is the button that I used and the javascript code:

function hide(identifiant) {

if (document.getElementById(identifiant).className == "hidden") {
document.getElementById(identifiant).className = "visible";
} else {
document.getElementById(identifiant).className = "hidden";
}
}

<td><input type="button" value="Create" onCclick="hide('createDiv')"/></td>
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Janice Guevara:
I think the problem may be that there is java code inside...any suggestions?



Your thinking is not correct.

By the time that the browser gets the page and any JavaScript can execute, no Java exists on the page anymore. JSP is a server-side templating mechanism that creates HTML pages to be sent to the browser. Please read this article for more details.

Your first debuggng step should be to do a View Source in the browser to see what is being delivered. Verify that all the HTML and JavaScript are as you expect.
[ August 10, 2006: Message edited by: Bear Bibeault ]
 
Janice Guevara
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes,you are right about the html code generated by the jsp.

I looked at the source code of my jsp and everything seems ok to me...

This is the html code that I want to hide:

<tr>
<div id="createDiv" class="hidden">


<td><input type="text" name="create_extension" /></td>


<td><input type="text" name="create_name" /></td>


<td><input type="checkbox" name="create_availableFromIVR"/></td>


<td><input type="checkbox" name="create_voicemailFlag"/></td>


<td><input type="text" name="create_mailbox" /></td>


<td><input type="text" name="create_email" /></td>

<td><select id="create_telephones" name="create_telephones" multiple="multiple" size="5">
<option value="mbonheur">
Monsieur Bonheur
</option>
</select>
</td>

<td><input type="text" name="create_password" /></td>

</div>
</tr>

and again the javascript function:

function hide(identifiant) {

if (document.getElementById(identifiant).className == "hidden") {
document.getElementById(identifiant).className = "visible";
} else {
document.getElementById(identifiant).className = "hidden";
}
}

I call the function with this button that is located in another part of my page:

<td><input type="button" value="Create" onCclick="hide('createDiv')"/></td>

just in case I didn't write correctly the onclick event in order to post this reply

thanks...
 
Bear Bibeault
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From this point on, it's an HTML and Javascript issue so I;ve moved this over to the HTML forum.
 
Janice Guevara
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks, I didn't notice there was an HTMl forum...

I hope someone can help me
 
Bear Bibeault
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your HTML is malformed:



You can't have a div outside of a <td> or <th> within a table.
 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

What do your 'hidden' and 'visible' CSS classes look like?
 
knowledge is the difference between drudgery and strategic action -- tiny ad
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic