Answer the question
In order to leave comments, you need to log in
How to check field value in Drupal 6?
Need to add field validation to Drupal 6 for a form? questionnaire?
In Drupal, I am a complete 0. But here it was required.
In the admin panel, this is called a questionnaire. Essentially a feedback form. Through the admin panel, no checks can be set separately for the fields.
How to make a hook and where I have no idea at all.
But the questionnaire itself has an Additional Validation field in the settings and in the comment to it it says that you can insert php there.
I googled a bit and found that it seems that the value can be accessed like this $form_state['submitted_tree'][FieldName] and throw an error like this form_set_error('submitted][FieldName', t('error text'));
It's not entirely clear how to get the name of the field, but in the html it's called name="submitted[phone]".
I concluded that it is called phone.
I write the following in Additional Validation (for testing purposes):
<?php
$phone = $form_state['submitted_tree']['phone'];
if ($phone == '+70') {
form_set_error('submitted][phone', t('Test error'));
}
?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question