3

When a CCK field accepts more than one value, the widget will display a sortable table (usually with those cross-shaped handlers); this is the default behavior. I would rather have a non-sortable widget, since the order doesn't really matter. I hope this will avoid the usage of a table element, as well.

How can I achieve this? Do I need to use hook_form_alter()?

3

I think you'll need to create your own module for this. Instead of using hook_form_alter(), I'd suggest doing things the "cck way". CCK provides hooks which allow modules to provide custom widgets for CCK fields. You can create a module to provide a new Widget option for multi-value fields that doesn't use an HTML table, and doesn't allow for reordering. There's a great article on Lullabot about this. It also talks about creating your own fields and formatters, but you can skip down to the widget part at the end. The sample code is very well documented and should help you understand what's happening. At the very least this will be a great starting point. If something in the article doesn't make sense, feel free to ask for clarifications and I'll add what I can.

  • +1 for this method. It's the "proper" way even though it's quite involved. – Chris Cohen Apr 19 '11 at 8:14
  • this is the wonderful answer i was expecting, thanks a lot. – Capi Etheriel May 5 '11 at 21:02
0

In lieu of another answer for the time being, have you considered hiding the handles using CSS or perhaps some jQuery?

Also, could you explain what you mean when you say 'avoid the usage of a table'? Did you mean database table, or HTML table?

  • I meant an HTML table element. – Capi Etheriel Apr 14 '11 at 20:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.