Linked Questions

1 vote
0 answers
87 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.
karthik's user avatar
  • 11
31 votes
8 answers
80k 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 ...
AngularChef's user avatar
  • 1,005
2 votes
2 answers
13k 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?
235's user avatar
  • 33
1 vote
2 answers
3k 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?
Rajesh Vishwakarma's user avatar
1 vote
2 answers
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 ...
Brian's user avatar
  • 454
2 votes
1 answer
2k 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 ...
ashash's user avatar
  • 383
0 votes
1 answer
2k 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 ...
Cesar's user avatar
  • 942
0 votes
2 answers
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' ...
Binny's user avatar
  • 934
0 votes
2 answers
871 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 ...
user avatar
0 votes
1 answer
492 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'][...
QuietSpecialist's user avatar
1 vote
0 answers
222 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 ...
Andy B.'s user avatar
  • 11
0 votes
0 answers
144 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 ...
Andi's user avatar
  • 255
1 vote
0 answers
113 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 $...
dfish17's user avatar
  • 33
-1 votes
1 answer
49 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 ...
Amrita's user avatar
  • 95