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?

1
  • So your main concern is simplicity? Commented Dec 9, 2012 at 11:55

2 Answers 2

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>');
});
Sign up to request clarification or add additional context in comments.

Comments

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.

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.