By mjvandermeulen on
I have made a custom node from scratch, not using CCK, because I need more control over the node than CCK can give me.
In the Add/Edit form I have a list of checkboxes. Using hook_insert (and hook_update) I want to save the selections. And in the hook_load I want to retrieve this.
How do I do this?
relevant code in hook_form:
$display_options = array(
'display_address' => t('Display my address'),
'display_email' => t('Display my email'),
'display_phone' => t('Display my home phone number')
);
$form['display_settings'] = array(
'#title' => t('Website Display Options'),
'#type' => 'checkboxes',
'#description' => t('Allow web visitors to see your personal address information. '),
'#options' => $display_options,
'#weight' => 10,
);
Comments
What options do you need
What options do you need that CCK doesn't give you?
---
gizra.com - where cool software developers meet geek fashion designers
What options do you need
I need to connect to the civiCRM database to display fields from that database.
I need to add checkboxes so owners of the node can choose to display certain fields or not.
I don't think I can use CCK for this.
It's all up and running now. I wrote a custom node module from scratch, using the drupal Pro book. It was a lot of work though.
So how did you do it?
I'm having the same sort of issues could you share your solution.
Dave
Figured it out myself
define the field as follows:
$services = array(
'Sales' =>t('Still Photography'),
'Service' =>t('Videography'),
);
$form['services'] = array(
'#type' => 'checkboxes',
'#title' => 'Last Name',
'#default_value' => explode(",", $node->services),
'#options' => $services,
'#required' => false,
);
Then in the SQL use;
$servicesstring = implode(",", $node->services);
as the value to save into the DB.
Hope this helps someone else.
Dave
Any solution you find for this
Is your solution working. Please let me know what solution you applied for it