0

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?

3
  • But do you have to change the name of any input field? You can use your own validation function by altering the form. Commented Aug 3, 2013 at 13:12
  • "...You can use your own validation function by altering the form...." can you explain this a bit more please? Commented Aug 3, 2013 at 13:22
  • Check api.drupal.org for hook_form_alter Commented Aug 5, 2013 at 4:42

1 Answer 1

0

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.