[development] decoupling form validation from error reporting and "actions" OR different use case for DANGEROUS_SKIP_CHECK
Moshe Weitzman
weitzman at tejasa.com
Wed May 21 14:05:24 UTC 2008
damn, thats sneaky. nice one.
On Wed, May 21, 2008 at 9:47 AM, Roberto Gerola
<roberto.gerola at speedtech.it> wrote:
> On Wed, 2008-05-21 at 11:44 +0200, Ivan Sergio Borgonovo wrote:
>
>> I'd consider *possible* that a user open another browser window
>> and change the previous choices while it is in the middle of the
>> process. Since the forms are dynamically built, when a $form is
>> "regenerated" for submission it may be different from the one that was
>> shown to the user.
>>
>> At this point form validation kick in and says
>> "An illegal choice has been detected..."
>
> Hi.
> I encountered the same issue working with dependent drop downs
> filled by Ajax and JS code.
>
> Here there is the technique I'm using in one of my projects.
> Not sure it is the best approach, but it is the only one
> I was able to implement when I ported my code from D5 to D6.
>
> Hope this helps.
>
> Roberto
>
> ***
>
> function storm_dependent_select_process($form, $edit, $form_state,
> $complete_form) {
> unset($form['#needs_validation']);
> return $form;
> }
>
> $form['group1']['project_nid'] = array(
> '#type' => 'select',
> '#title' => t('Project'),
> '#default_value' => $node->project_nid,
> '#options' => array(0 => '-') + $projects,
> '#process' => array('storm_dependent_select_process'),
> '#required' => true,
> '#attributes' => array('onchange' => "stormtask_project_tasks(this, 'edit-task-nid', true, '-')"),
> );
>
>
>
More information about the development
mailing list