0

I want to add Custom HTML ("Login" link near the "Register" button) in Register form with ZF 1.12.

When I do that with:

$submit = new Zend_Form_Element_Submit('register');

$submit->setDescription(" or <a href='auth/login'>Login</a>");

... then the link is placed in the next row, but I need it close to the "Register" button.

How can I implement it as simply as possible?

Cat
  • 66,919
  • 24
  • 133
  • 141

2 Answers2

0

You have to create a custom form decorator for that. It is not that simple. If you have no other option then its better to create new decorator and add it to the form element. The ZF manual have a good documented section for that Creating Custom Form Markup Using Zend_Form_Decorator. This SO post will help too Insert custom HTML into Zend_Form.

there is also a quick workaround using javascript (if you are using jquery)

$(document).ready(function() {
  $('#register').after(' or <a href="auth/login">Login</a>');
});
Community
  • 1
  • 1
Nandakumar V
  • 4,317
  • 4
  • 27
  • 47
0

The description for the submit button, should surely be something more like:

'Activate button, to register.'

Arguably the login link isn't directly related to the form either. So I'd just place that text after the form.

<?php echo $form; ?>
<p>Or <a href='auth/login'>Login</a></p>

If you think the login link should always belong to the form, you could perhaps add it to the form description.

Progrock
  • 7,373
  • 1
  • 19
  • 25