0
votes

i have a checkout-page (drupal commerce) form with an address section generated by the module addressfield. currently all text-inputfields have this markup-structure:

<input class="last-name" id="edit-last-name" name="customer_profile_billing[commerce_customer_address][und][0][last_name]">

class + id + name

with this config they validate.

if i change the value of the name attribute the form doesnt validate anymore, the form says:

field XY is required

the form-validator obviously doesnt recognise my inputs.

question: how can i get the validation process to work with a modified name attribute?

1
But do you have to change the name of any input field? You can use your own validation function by altering the form. - Bhavin Joshi
"...You can use your own validation function by altering the form...." can you explain this a bit more please? - user19578
Check api.drupal.org for hook_form_alter - Bhavin Joshi

1 Answers

0
votes

You should not be altering the generated HTML in any way. Drupal provides a special way of handling forms and a special way to alter other modules forms. To change the form you should use the configuration options presented to you by the module. If those are insufficient you should create your own Drupal module and then implement hook_form_alter to change the other form. You will need to understand Drupal's hook system.