2011-02-25 56 views
0

如何設置自定義內聯錯誤消息在節點中形成(包括cck和所有的東西)?drupal6錯誤ajax內聯

我看見幾個模塊,但他們沒有給出一個100%的解決方案,因爲沒有CCK-支持,上傳支持,錯誤信息等

+2

即使在我編輯的問題,以使它有點更具可讀性,我還是不知道你問的。你可以說得更詳細點嗎?例如,您希望在新消息中更改哪條消息。 – berkes 2011-02-25 17:45:59

回答

0

我猜你正在尋找做定製驗證在CCK領域?

在這種情況下,您可以通過創建模塊並實現hook_form_alter()並創建自己的驗證函數來添加函數。

function mymodule_form_alter(&$form, &$form_state, $form_id) { 
    switch ($form_id) { 
    case 'story_node_form': // Or whatever content type you're checking 
     // Simply add an additional link validate handler. 
     $form['#validate'][] = 'mymodule_field_validate'; 
     break; 
    } 
} 

function mymodule_field_validate($form, &$form_state) { 
    if (!somevalidatorfunctionorother($form_state['values']['my_custom_field']) { 
    form_set_error('my_custom_field', t('Text of your error message.')); 
    } 
} 

我適應上面的代碼從這個帖子:http://fleetthought.com/adding-additional-cck-validation-function-field-using-hookformalter