Active
Project:
Extra Fields Checkout Pane
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
11 May 2011 at 20:19 UTC
Updated:
23 May 2011 at 12:55 UTC
Jump to comment: Most recent file
Comments
Comment #1
maurizio.ganovelliHi ledom, this feature is very interesting. I think the easiest way for user would be to have a trigger for extra field validation, but i must work on it to see if it's possible. For the moment, you can try to use "Rules Form support" in Rules package, adding event/conditions on checkout form validation.
Comment #2
ledom commentedThanks Blackice78! I just give it a try and it seems it can do the job. I forgot this usefull form module... To much modules...
My goal for this request is testing Delivery Day extra field and check cart for wrong products and remove them. Now I just need to see if checking cart and remove products is possible.
Comment #3
megachrizIf you want to validate a field only, you can also do this in a custom module with a form alter hook.
See this example: #888128: Validation for the extra fields
Comment #4
megachrizCorrected issue title.
Comment #5
maurizio.ganovelliHi all,
in attachment you can find a patch (and a new file to add rename it to uc_extra_fields_pane.ca.inc) for 6.x-2.x dev version. The patch provide a simple integration with Conditional Action, adding two new triggers "Extra Fields: Checkout Form Validation" & "Extra Fields: Order Edit Form Validation". These functions get called during validation of the checkout and order edit forms. User can then add conditions/actions with the possibility to execute custom php code: submitted form values are passed as argument "$form" (the second --$form_state-- argument of original validation function).
I hope it can be useful.
Comment #6
megachrizI've tested the patch, but I don't see a reason why we should add this to Extra Fields Pane. With this patch, if you want to validate the form, you still need to know PHP in order to validate it. You even need to know PHP to set the conditions (except if you want to set the condition "Check the current date"). In that case I think you might as well add the validation rules in a custom module.
I haven't tested "Rules Form support", but it sounds like that would be a good alternative.
Opinions?