Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-03-2008, 01:14 AM
Junior Member
 
Join Date: Aug 2008
Posts: 28
Default using form elements one at a time

I have a zend_form with several elements. Instead of just calling the entire form in my view I would like to call individual elements so I can place them in various places on my page. I call the elements like so:
PHP Code:
echo $this->form->getElement('date_required');
//some html in between......
echo $this->form->getElement('submit'
When I do this my submit button does nothing. So I tried adding this to my view file:
PHP Code:
<form action="<?php echo $this->form->getAction(); ?>" method="<?php echo $this->form->getMethod(); ?>" >
<?php echo $this->form->getElement('date_required');
//some html in between......
echo $this->form->getElement('submit'); ?>
</form>
But that doesn't work either. In my controller I have:
PHP Code:
$form = new Form();
        
$form->submit->setLabel('save changes');
        
$this->view->form $form;

        if (
$this->_request->isPost())
         {
            
$formData $this->_request->getPost();
                if (
$form->isValid($formData)) 
                { 
//do stuff.....}
          

Can anyone help???
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 11-06-2008, 04:02 AM
Senior Member
 
Join Date: Jun 2008
Location: Florida
Posts: 108
Default

Did you look at the HTML that your PHP page generated? Were all of the form elements between the <form> tags as they'd need to be to successfully submit the form, etc...?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 11-07-2008, 12:45 AM
Junior Member
 
Join Date: Aug 2008
Posts: 28
Default

Yes, I ended up checking out the page source. That's always a good thing to do, sometimes I forget. I actually got it working at one point, came back the next day and now it doesn't work again. I hate when that happens. Oh well, guess I'll look at it again tomorrow and maybe something will jump out at me then. Thanks for the suggestion.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 10:25 PM.