Consecutive Numbering

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 1
Joined: Tue Oct 16, 2012 5:43 pm

Consecutive Numbering

Postby CMYKreative » Tue Oct 16, 2012 5:45 pm

I'm trying to hide some specific <tr> rows on the registration form in VirtueMart/Joomla that are not needed, but there is no way to 'target' them as it uses the same piece of coding to create all the rows.

What we have at the moment is:

echo ' <table class="adminForm user-details">' . "\n";
$_table = true;
echo ' <tr>' . "\n";
echo ' <td class="key" title="'.$_field['description'].'" >' . "\n";
echo ' <label class="' . $_field['name'] . '" for="' . $_field['name'] . '_field">' . "\n";
echo ' ' . $_field['title'] . ($_field['required'] ? ' *' : '') . "\n";

Where the td class is simply called "key" and all td are then called the same. We are trying to add in some consecutive lettering functionality so that each row then gets labelled with a consecutive number.

We've tried adding this into the top of the page:

// array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i');
foreach (range('a', 'z') as $letter)
Which does generate consecutive letters, and then this change to the code:

echo ' <td class="key td-id-'.$letter.'" title="'.$_field['description'].'" >' . "\n";

Any thoughts on how to get this to work?

Thanks in advance!

php-forum Fan User
php-forum Fan User
Posts: 973
Joined: Mon Oct 01, 2012 12:32 pm

Re: Consecutive Numbering

Postby seandisanti » Thu Oct 18, 2012 7:15 am

If you use consecutive numbering then selectively hide rows based on those numbers, their absence will be obvious. You should be able to either refine your query to skip those rows, or use CSS to hide the ones you don't want.

php-forum Super User
php-forum Super User
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: Consecutive Numbering

Postby johnj » Fri Oct 19, 2012 10:00 pm

add a 'id' attribute to each of the rows and the hide the one that you do not need using jquery.

Code: Select all

<tr id='hide_this'>test this</tr>

then using jquery, you can do something like this:


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 2 guests