Hiding rows

Hi!

Have you already tried to remove fields as described in this article?

I've been using this quite some time now, but I noticed something weird. When you have removed two fields which are on the same line, then you don't want to see this row at all. Well, this doesn't work by default.

By using jscript you'll need to access the table row and hide it. This doesnt work with the style.visibility = 'hidden'. Instead, you should use this line:


crmForm.all.field.parentElement.parentElement.style.display = 'none';

This row should remove the whole line. Yes, thats what it should do. So if it doesn't do that, what does it do? It removes everything except for picklists. You’ll need to hide those manually as described in the other article:
crmForm.all.picklist_d.style.display = 'none';


It's not business critical, but it does fine-tune your UI when working with advanced UI manipulation.

Good luck!

Update:
Robert Amos mailed me his solution. He's hiding complete sections. Here's part of his mail:

I usually pick the first (top left) field in CRM and work on it:
crmForm.all.firstfield_c.parentElement.parentElement. parentElement.style.display = 'none';

That should pick the element containing the entire section and suck it out of the form. So I've been hiding non-relevant sections so the user doesn't get confused. Keeps it clean :)

7 comments:

Gaploid said...

try this:
crmform.myFiled.removeNode(true);

=)) i think it`s much better.

Ronald Lemmen said...

Hi Gaploid,

Thanks for your contribution. The command "removeNode(true)" you have mentioned does remove a field. The label remains though.

Furthermore there's quite a problem when you would like to enable the field again. But then again, if you don't need to enable the field, then the code does look a lot nicer then the ones I have mentioned :)

gaploid said...

imho if you use style to remove field you can still see a empty space. my example remove this space=)

Sharlini said...

Hi!

How do i make them visible again depending on the value in a picklist?

Regards,

Sharlini

Anonymous said...

Sorry! i am talking about the the entire section - how do i make the section visible again?

Regards,

Sharlini

Ronald Lemmen said...

Sharlini,

That would probably be:
crmForm.all.firstfield_c.parentElement.parentElement. parentElement.style.display = 'inline';

Sharlini said...

Thanks Ronald, i did have that but i put in an if statement and dependent on the value of a picklist. After much pain, i realise it isnt the code that isnt working, its my if statement :(
if you have any ideas on this, i would appreciate it - email sharlini@liquidthought.co.za otherwise thanks for all your help - its been really informative!