1
frankblack
How to hide a xoopsform element row?
  • 2010/1/5 12:00

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


Can anyone point me to a clever way to hide a table row containing a xoopsform element?

Of course there a ids for the elements (have fun with calendar elements) and I can access them, BUT this would only hide the element itself and NOT the complete table row.

A freaky way would be:
document.getElementById("whatever").parentNode.parentNode;


BTW: it must be onchange instead of onChange.

2
frankblack
Re: How to hide a xoopsform element row?
  • 2010/1/5 14:19

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


Noone? OK, here is the complete crappy solution (even with jquery):

$xoTheme->addScript(null, array('type' => 'text/javascript''charset' => _CHARSET), '
$(document).ready(function() { 
document.getElementById("xoops_date[appear[date]]").parentNode.parentNode.style.display="none"; 
document.getElementById("xoops_date[vanish[date]]").parentNode.parentNode.style.display="none"; 
$("#timeset").click(function(){ if( $("#timeset").is(":checked")) { 
document.getElementById("xoops_date[appear[date]]").parentNode.parentNode.style.display="table-row"; 
document.getElementById("xoops_date[vanish[date]]").parentNode.parentNode.style.display="table-row"; } else { 
document.getElementById("xoops_date[appear[date]]").parentNode.parentNode.style.display="none"; 
document.getElementById("xoops_date[vanish[date]]").parentNode.parentNode.style.display="none"; } }); }); '
);


The first lines we need, because there is no way to identify the table row to make it initially invisible, because it looks like this:
<tr valign="top" align="left"><td class="head">


With the click on a checkbox the table rows will vanish. Another click shows them again.

But we have always to climb up the "dom-ladder" with parentNode.parentNode.

I praise the day we are getting rid of the table based xoopsform.

Login

Who's Online

126 user(s) are online (71 user(s) are browsing Support Forums)


Members: 0


Guests: 126


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits