drupal-alter

Stop a custom submit button from firing the form validation on a CCK form

I've added a submit button inside a fieldgroup on a CCK form using hook_form_alter as follows: function mymodule_form_alter(&$form, $form_state, $form_id) { if ($form_id == 'object_node_form') { $form['group_wikipedia']['search'] = array( '#type' => 'submit', '#value' => t('Search Wikipedia'), '#name' => 'searchwiki', '#subm...

drupal - override form action?

I originally started this question in another thread, but that thread was sorta, kinda answered, and now I primarily want to know how to specify another form action... I tried using the code below, but the form action, when output, remains unchanged, although looking at the print_r($form), it's correctly changed... Why isn't it picking ...

Drupal: adding disclaimer text above the submit button in a webform

Hi, Is there an easy-ish way to modify the webform-form-tpl.php template to show disclaimer text above the submit button in a Drupal webform? I can add text below the button, but do not know how to split up the button from the other elements to add text between them, ie: [form-elements] [disclaimer text] [submit button] Cheers! ...

drupal module alter view or node

I have been using hook_alter to modify forms in a custom PHP module. I started to take the same approach modifying the result page of "node add" form. However this page is not a form so I don't have a form ID to hook on to. Actually it contains a login form, but that does not contain the elements that I am looking for. Next I cloned th...

Drupal: collapse CCK Fields in edit content pages ?

hi, can I collapse the field in my edit-content page in Drupal ? For example, at the bottom of the page Revision Information, URL Path Settings, Authoring Information etc are collapsed. I would like to have this functionality for the CCK Fields as well. thanks ...

Drupal hook alter with hook validate

I have a CCK defined form called 'mytype_node_form'. I create a module called form_overrides I create a function called form_overrides_form_alter where I successfully check for $form_id = 'mytype_node_form' Question: What should be the name of my validation function (hook_validate) in module form_overrides that would allow me to add ...

Problems in user - registration module in DRUPAL

Hello Guys, I have some problem in drupal registration page. I want to change whole user registration page. in registration module i want to add new field type. Bcz i want that user can choose the date from date-time picker. I have ready date-time picker which i have implement, but i don't know where to put that code. I want to...

Getting altered form values in drupal

I created one module in drupal name as newmodule.I use form alter to alter user registration form for adding one field location.When i submit the form, how i can get the value of the new field which i created . ...

Validation on user registration form ?

Hey Guys, i have made module in which i am trying to add validation like if the user had entered the characters in "Phone No" text filed and same on "Mobile No". This will run when user had open the user registration form. I have made this.... <?php function form_intro_form_alter($form_id,&$form){ if($form_id == 'user_register' || ...

Checking whether a user already exists in drupal.

Hello, When a user enters his login information and hits submit, i want to check if the user already exists or not. So, i have the following two questions 1. Which hook is needed to be implemented , for the case when user hits the submit button on the login form. I need the username entered by the user. 2. How to check if a user already...

form layout in drupal from a module

I created my own module called "cssswitch". I'm trying to create my own html layout to display the admin form portion of the module. I understand how to use the hook_form_alter() to modify form elements, but I need to create the entire form layout to make some fields appear next to each other. It seems I need something like the way I hav...

Default values for Content Taxonomy fields in Drupal with Hierarchical Select widget

I'm trying to set the default value for a Content Taxonomy field in a hook_form_alter, but can't pin down the necessary format. I've tried this and many variations: foreach (element_children($form) as $child) { // Set $default_value. if ($form[$child]['tids']) { // This, for Content Taxonomy fields, isn't working: $form[$child]['...

How do I update a node (book or Page) before saving it without touching the module code in Drupal?

I would like to set some values in the node before actually writing the data to the DB. I already have it working by modifying book_nodeapi but I would like to do it from outside the code, some _alter option that allows me to leave the module code untouched would be great. Thanks ...

Registration during content creation in Drupal?

Is there an easy way to allow a user to register as he creates content type. E.g. Let's say there is a content type called "listing". When the user clicks to on a link to create it, and he's not logged in, I want a "register" box to appear ABOVE THE CONTENT CREATION area, where the user can enter his normal registration details. Is this ...