I'm looking for a way of mergin 2 fields into html select item. First field is links to other nodes within drupal, second field is links to another external content. Now I would like to merge these fields into html, which I could program "onChange" to follow selected link. Any ideas? Should I override both .tpl.php for that field, then with jQuery build one select? Or maybe this could be done easier, before rendering? Or maybe views might be enough? View, type of entity, added to certain node.. but then I have problems finding way of displaying those fields at the same time. Any advices?
2 Answers
I'm not sure what exactly you want to achieve. Maybe this two modules are helpfull for you:
Ok, that was simpler than I thought. Creating view, context filter for NID, fields I want, then I use it as entity for content type I want. Then in my module I use hook_views_post_render and attach JS where I detect if view I attach has any items. If it does, I fetch them and build select list from it, then hide original view and attach created select instead.