Hi,

I have been trying to alter the value of a date popup cck field programmatically (based on the choice a user makes for another field). I want to change the value after the user has completed the form but before (or during) drupal's submit to database.

I've tried custom validation functions (and amending the value in $form_state and also using form_set_value .

But the changed value always seems to get overridden later on down the line.

So for example, I created a s[my_module]_popup_validate function which operates at the same time as the default date_popup_validate function.

    // set new value
    $form_state['values']['field_date']['0']['value'] = $new_date; 
    form_set_value($element, $new_date, $form_state);

Note I tried these individually. $new_date was in the same format as date_popup_validate outputs.

But that didn't work.

I also tried later in the process, by doing the same thing but in a node validation function. Again, the value does not persist.

Any clues on this ? (I've looked around for docs and posts/issues but to no avail).

Even a pointer to how the general process works would be great.

Thanks,

nicl

Comments

nicl’s picture

Issue summary: View changes

Improved description.

jiv_e’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

I'm sorry you didn't get any support. This issue is getting old. I'm cleaning the issue queue, so I'll close it.