-1

enter image description hereI am getting this html of add to cart button

<button type="submit" id="edit-submit" name="op" value="Add to cart" class="btn btn-success form-submit">Add to cart</button>

I am using this code in hook_form_alter().

$form['submit']['#attributes']['title'] = $form['submit']['#attributes']['value'] = t("Applied");
2

Assuming $form['submit'] is the correct element:

$form['submit']['#value'] = 'New value';
  • Its changing value of input box.. not a text its return me <button type="submit" id="edit-submit" name="op" value="New value" class="btn btn-success form-submit">Add to cart</button> – Johny Mar 23 '17 at 2:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.