By mysocom on
How can I disable cck button in node edit ?
I inserted code in hook_form_alter:
if($form_id == 'page_node_form') {
$form[field_gmap_button] = array(
'#type' => 'hidden'
);
}and remove button in node edit but in node view too and get error
warning: Invalid argument supplied for foreach() in C:\www\...sites\all\modules\cck\content.module on line 450.
print_r($form)
[field_gmap_button] => Array
(
[#tree] => 1
[#weight] => 0
[#type] => fieldset
[#title] => Mubutton
[#description] =>
[0] => Array
(
[button_enabled] => Array
(
[#type] => checkbox
[#title] => Enable button
[#default_value] => 1
)
[button_label] => Array
(
[#type] => hidden
[#value] => Submit
)
[button_html] => Array
(
[#type] => hidden
[#value] => type="button" class="cck-button"
)
[button_php] => Array
(
[#type] => hidden
[#value] => // Sample code (show how to handle a click event with jQuery):
drupal_add_js(
'$(document).ready(function() {
$("input.cck-button").toggle(function() {
$label = $(this).val();
$(this).val("Click me!");
}, function() {
$(this).val($label).fadeIn("slow");
} );
} ); ',
'inline'
);
)
)
)