Simpanoz
Simpanoz

Reputation: 2859

Zend Framework: How can i set name attribute of an element

1- How can I set 'name' attribute of 'form' html tag in Zend Form.

2- How can I set 'name' (not 'value' attribute) attribute of an element in Zend Form.

Thanks in advance

Upvotes: 1

Views: 3143

Answers (2)

Progrock
Progrock

Reputation: 7485

In ZF1, you can call setName on the form. Which sets both the name and id of the form.

    <?php
    // Your form definition
    $form->setName('blahForm');
    echo $form->setView(new Zend_View);
    ?>

Outputs:

    <form id="blahForm" name="blahForm">...</form>

Upvotes: 0

David Weinraub
David Weinraub

Reputation: 14184

1- How can I set 'name' attribute of 'form' html tag in Zend Form.

$form->setAttrib('name', 'myForm');

2- How can I set 'name' (not 'value' attribute) attribute of an element in Zend Form.

$elt->setName('myElement');

Upvotes: 4

Related Questions