function merci_inventory_autocomplete_validate in MERCI (Manage Equipment Reservations, Checkout and Inventory) 7.3
1 string reference to 'merci_inventory_autocomplete_validate'
- merci_inventory_views_bulk_operations_form_alter in merci_inventory/
merci_inventory.module
File
- merci_inventory/
merci_inventory.module, line 88
Code
function merci_inventory_autocomplete_validate($element, &$form_state, $form) {
$name = drupal_array_get_nested_value($form_state['values'], $element['#parents']);
$matches = array();
// This preg_match() looks for the last pattern like [33334] and if found
// extracts the numeric portion.
$result = preg_match('/\\[([0-9]+)\\]$/', $name, $matches);
if ($result > 0) {
form_set_value($element, $matches[$result], $form_state);
}
}