0
A
回答
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
相關問題
- 1. Drupal6:試圖從node_validate)錯誤(
- 2. PHP解析錯誤; Drupal6部署
- 3. Django-ckeditor內聯錯誤
- 4. MATLAB內聯函數錯誤
- 5. 內聯svg邊框錯誤
- 6. 內聯彙編錯誤
- 7. Django內聯formset錯誤
- 8. C++內聯彙編錯誤
- 9. 運行內聯錯誤:: C
- 10. Rails 3內聯錯誤
- 11. GCC內聯彙編錯誤
- 12. 聯盟與內部聯接,MySQL錯誤
- 13. 使用simple_form在Bootstrap Ajax模式中顯示內聯錯誤
- 14. CodeIgniter + AJAX內部錯誤500
- 15. Ajax內部錯誤,jqXHR:underfined
- 16. ajax後內部500錯誤
- 17. JQuery Ajax 500內部錯誤
- 18. AJAX級聯下拉方法錯誤500
- 19. HTML錯誤:顯示內聯塊,而不是內聯?
- 20. 多個內部聯接錯誤
- 21. 內聯函數鏈接器錯誤
- 22. css_parser錯誤地解析內聯CSS嗎?
- 23. iOS中的內聯asm錯誤
- 24. 錯誤的擴展方法內聯
- 25. SQL查詢內部聯接錯誤
- 26. 錯誤在具有內聯XML DTD
- 27. 錯誤內聯彙編在VC++ 2010
- 28. 內聯組件C.錯誤翻譯
- 29. Internet Explorer內聯邊框錯誤
- 30. 內聯jqGrid編輯「請求錯誤」
即使在我編輯的問題,以使它有點更具可讀性,我還是不知道你問的。你可以說得更詳細點嗎?例如,您希望在新消息中更改哪條消息。 – berkes 2011-02-25 17:45:59