Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By FLX on
Hi,
I'm busy with Drupal 7 (awesome!) and I'm tinkering with content types. I'd like to create a content type field that accepts dutch license plates, which are in the form of XX-XX-XX or XX-XXX-X.
X is always uppercase alphanumeric.
How can I validate if it's posted in either format?
Thanks,
Dennis
Comments
Look at the field API. It
Look at the field API. It allows you to create new fields with their own validation.
Thank you for your swift
Thank you for your swift reply, it's much appreciated :-)
I'm very new at Drupal 7 and the field API isn't fully explanatory, would you happen to have an example for me to chew on?
Many thanks,
Dennis
Here's a start:
Here's a start: http://drupal.org/node/707832
Unfortunately it's not a great start. I read about it in a book. But I'm sure if you do some searching around you can find more information in order to do this.
There's a module for that...
I have the same problem. I googled and found your post. And next, I found this post, which describes a new module: Field validation.
It solves our problem rather neatly without tinkering with PHP code.
What it doesn't do (one for the wishlist...) is cleaning up data so it conforms more to an ideal, for example, changing lowercase letters into uppercase, trimming whitespace, etc.
You could create a custom
You could create a custom template for the content type that performs those operations, or better yet use CSS to do that for you.
.uppercase {
text-transform:uppercase;
}
Field validation Module Works
Thankz bartl.. That was the exact module i was looking for to validate additional profile fields that i have added in user registration pages for Drupal 7...
Field Validation based on list
Can this module verify the field based on a list of pre-determined words/characters?
I'd like to add a custom field to user profile for user to input a serial number, which is matched to a predetermined list of serial numbers. Can this or another mod do something like that?
Thanks
Hey ho heres a small
Hey ho heres a small example:
Hey BlackyWhoElse, Thanks for
Hey BlackyWhoElse, Thanks for that code. I know it's been a while, I didn't get a notification of a reply. >.<
I'll try to test it and give feedback as soon as I can (which may take a while).