By sisko on
Hi all,
I am using the content taxonomy module to create a select list of taxonomy options.
The same taxonomy is used in 2 different content types. But one of the terms is not applicable in the second content type.
Can anyone advise me on how to use hook_form_alter to access the select list and remove the one term that is not applicable for the second content type?
Comments
Custom Module
I have done this by creating a custom.module for the site, which had custom_form_alter() function, which implements hook_form_alter hook.
Here is a good tutorial
http://www.lullabot.com/articles/modifying-forms-drupal-5-and-6
Big problem ...
I have spent an entire day trying to find the select list data.
I hook_form_alter I called dpr($form['field_transaction_type']); and got the following output:
Array
(
[#type] => optionwidgets_select
[#default_value] => Array
(
[0] => Array
(
[value] =>
)
)
[#required] => 0
[#columns] => Array
(
[0] => value
)
[#title] => Transaction Type
[#description] =>
[#delta] => 0
[#field_name] => field_transaction_type
[#type_name] => advert_land
[#tree] => 1
[#weight] => 32
[#access] => 1
[#count] => 9
)
My taxonomy, called Transaction Type, has 3 options( Lease, Rent and Sale ).
None of them are represented in the output so I have no way of altering the select dropdown list.
Can anyone please help me !?
BUMP!
I can't find any of the options of my taxonomy select list represented when I do a print_r of my edit form.
Can anyone please tell me how I can access my select list options so I can remove one of those options, please
Two questions
1) Have you tried a
dpr($form)to look at the whole form?2) Also what is the $form_state and $form_id ?
3) I assume you are using D6?
thanks
dpr($form) yields alot more
dpr($form) yields alot more information but none of it relating to the terms of the taxonomy.
Don't know what $form_state and $form_id contains ( I will check those ).
And yes, I am using D6.
Watch the weight ??
I just found out there might be an issue with the "weight" of my module.
Aparently, I need to make my module's "weight" more than the the taxonomy module's weight.
If this makes sence to anyone in the context of this problem, can you please tell me how I can accomplish this?
Setting module weights
I believe this may help:
http://drupal.org/node/110238
Note - I have never personally done this.