Linked Questions

1
vote
0answers
80 views

How write form validation to custom content type form? [duplicate]

I am using the drupal 7 content type like my form i dont know how write the form validation to that particular form.
21
votes
7answers
42k views

How do I add a custom validation handler to an existing form/field?

How do I add a custom validation handler to an existing form (or form field) in Drupal 8? I have a form that I haven't created. I want to add my own validation rules on some fields when the form is ...
2
votes
2answers
9k views

How do I add custom validations to Webform?

I have created the country and state fields with the Webform module, and I want to add a field validation for the state field when user select US as country. How can I achieve this?
2
votes
1answer
1k views

How to create a checkbox field in a node for Terms and Conditions

I need a field to ensure the users who create a node accept my Terms and Conditions. I've gone as far as creating a boolean field and making it a required field but I don't know how to: 1) Disallow ...
1
vote
2answers
2k views

Validate textfield

I created a custom content type with textfield called productID. Well all the data is imported and now he wants that field to be validated against a list of productId's. I have not imported the list ...
0
votes
2answers
1k views

How to validate a file upload field added to a form using hook_form_alter?

I am trying to add a file upload field to all story node forms. I tested the code and I am successfully getting the file upload field on the form. $form['my_file_upload'] = array( '#attributes' ...
1
vote
2answers
1k views

How do I skip validation for node form element?

I have a content type having 10 fields that are all required. How do I skip validation for some fields? Is there any hook/function that allow me to do this?
0
votes
1answer
1k views

How can I hide Delete option from Operations in Admin - Drupal 7

I have a user with a role with restricted permissions. The content type is restricted to "Edit" only. However, the Operations Select box still displays Delete. Well, as I can check several ...
0
votes
2answers
635 views

Validate URL with a specific pattern?

Anyone know of a module that can check the base path of the URL to ensure the user is entering the correct URL? I.e. the field is asking for the Facebook URL but they put in a Twitter one. So ...
0
votes
1answer
222 views

Add hidden field to checkbox and submit unchecked value

I want to submit a value if a checkbox is unchecked (on a node edit form). Using theme_form_element I can add the hidden field as follows: $variables['element']['#children'] = '$variables['element'][...
1
vote
0answers
191 views

Webform validation with multiple conditions

I am wondering if it's possible to verify a webform with the following type of condition: If a text field contains "stringA", then a numeric field must also have a value of at least 20. Or, if that ...
0
votes
0answers
125 views

Drupal Commerce Price Validation

I'm searching for the spot, where the price field validation is done as I want to do some more checks here. But I only found the commerce_product_product_form_validate function which is only doing the ...
0
votes
1answer
44 views

Make Exposed form view content only appears to logged in user

I have created a view and exposed that form. I want when user click on exposed form search button it should show register or login form if user is anonymous otherwise it should show result. After user ...
1
vote
0answers
30 views

How to programmatically check whether field on form has changed in hook_form_alter

In rules you have the ability to check whether a field in a form has been changed by negating node-unchanged:field-xyz = 123. I want to check whether a field has changed programmatically with the $...