drupaldrupal-7drupal-nodes

How to filter field when adding node in Drupal


My Drupal site has form for adding node.
Node can be added by guest, so I need to filter field 'phone'.
Give me advice how I can add array with prohibited phones.

If completed form is sent with phone from photibited array Drupal wouldn't have to add this node.

Thank you


Solution

  • You could use Field Validation and use a word blacklist validation system for your phone field. If the phone field contains a prohibited number (one of the blacklist you created) the node won't be created and a proper alert will be displayed.

    This module can handle many validation systems (regex, blacklist, numeric, length, whitelist...), it should suit your need.

    Good luck