I want add some additional submit function to the form, I tried to use the form id in views, but without success.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

geraldito’s picture

You just have to look for the form name and do something like:

if ($form_id == 'views_form_nameofyourview_page'){
	$form['#after_build'][] = 'nameofyourmodule_views_form_nameofyourview_page_after_build';
}
chertzog’s picture

Issue summary: View changes
Status: Active » Needs review

WiIth the latest dev:

Around Line 472:
Change:

    $temp_form = array(
      '#parents' => array($field_id, $row_id),
      '#tree' => TRUE,
    );
   
    $form[$field_id][$row_id] = editablefields_form($temp_form, $form_state, $entity_type, $entity, $field, $instance, $langcode, $display);

To:

    $edit_form = drupal_get_form('editablefields_form', $entity_type, $entity, $field, $instance, $langcode, $display);
    $form[$field_id][$row_id] = $edit_form;
vaibhav571’s picture

You can use this patch to alter the forms using hook_editablefields_form_alter to alter the forms which will be rendered while in the editing mode

reevo’s picture

I found the patch in #3 resulted in editable fields failing to render unless hook_editablefields_form_alter was invoked. The attached patch achieves the desired outcome by using drupal_alter to enable alteration of both the $form and $form_state.

joelpittet’s picture

Category: Support request » Feature request

Seems to moved to a feature request

Collins405’s picture

Even with patch 3, any hook i use simply gets ignored by the editable field.

I can see the results in devel dpm() but nothing happens in the actual field.

joelpittet’s picture

Why can't this be done as a hook_form_alter? Sorry if you described this already

reevo’s picture

@joelpittet I distinctly remember being unable to achieve any alterations to editable fields, which is why I found this issue in the first place, however this no longer appears to be the case.

So, I'm happy to confirm that I'm now able to alter editable fields using the standard hook_form_alter. Please note, though, that I'm not rendering editable fields using Views as others in this thread appear to be.

joelpittet’s picture

Thanks for the confirmation @reevo

mducharme’s picture

Status: Needs review » Closed (outdated)

Since hook_form_alter can be used now, the original issue is now outdated. Marking as such.