Last active
December 18, 2015 19:04
-
-
Save nrackleff/30a173619b98a664931c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Inside form alter function insert validation using buttons like commerce does. | |
// Insert the validation at the beginning of the array so the commerce module | |
// can access any of our errors and place them in the correct block instead of at top of page. | |
array_unshift($form['buttons']['continue']['#validate'], 'treepeople_commerce2_organization_validate'); | |
// Inside the validate function, set the errors using a special concatenated field name | |
// that include the panel the field is in. Notice there are no outer brackets. | |
form_set_error('customer_profile_billing][field_organization_name', t('Company/Organization Name field is required.')); | |
The commerce validation function will use that naming convention to place the error is the proper location on the page. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment