By eddy147 on
Hi
Im trying to create a combo field, similar to http://www.poplarware.com/cckfieldmodule.html.
Instead I have 2 textfields and 2 datefields, for a resume field. (title, from, until, description).
The problem that I encounter is that it looks like that my process function is not getting called:
In experience_fld.module:
function experience_fld_elements() {
$elements = array( 'experience_entry' =>
array(
'#input' => TRUE,
'#process' => array( 'experience_fld_widget_process' ),
),
);
dpr($elements);
return $elements;
}
The processor goes through experience_fld_elements() . I can see the array $elements.
And in experience_fld_widget.inc: (there's nop die because it never goes through this function!!)
function experience_fld_widget_process($element, $edit, &$form_state, $form) {
die(__FUNCTION__);
$defaults = $element['#value'];
$field = content_fields($element['#field_name'], $element['#type_name']);
$element['title'] = array(
'#title' => t( 'Title' ),
'#type' => 'textfield',
'#default_value' => $defaults['title'],
'#weight' => 2,
);
$element['from'] = array(
'#title' => t( 'From' ),
'#type' => 'datetime',
'#default_value' => $defaults['from'],
'#weight' => 3,
);
$element['until'] = array(
'#title' => t( 'Until' ),
'#type' => 'datetime',
'#default_value' => $defaults['until'],
'#weight' => 4,
);
$element['description'] = array(
'#title' => t( 'Description' ),
'#type' => 'textarea',
'#default_value' => $defaults['description'],
'#rows' => 5,
'#cols' => 40,
'#weight' => 5,
);
return $element;
}
Anybody got a clue?
Comments
So you are building a form
So you are building a form with the form API and you have an element with '#type' set to 'experience_entry'? What display in the form for that field? Any errors?
No errors... Im wondering
No errors...
This is part of a widget.
Im wondering about experience_entry. I thought i could freely give this is a name. Maybe I can not?
Or maybe I should do something like
That would not really help,
That would not really help, you want only one element where the processor produces the 4 inputs.
Can you add your field to a content type? Does it show on the edit form?