开发者

CakePHP - FormHelper not outputting form tags

开发者 https://www.devze.com 2023-04-12 02:00 出处:网络
I have the following form declaration: <div class=\"edit-dialog span-10\" style=\"display:none;\">

I have the following form declaration:

<div class="edit-dialog span-10" style="display:none;">
  <div class="edit-message span-10" style="margin-bottom:30px;">
    <span>Editing: <a style="text-decoration:none"></a></span>
  </div>
  <?php
    echo $this->Form->create('Voicenote', array('action' => 'edit'));
    echo $this->Form->inpu开发者_如何学Got('title', array(
      'div' => false,
      'class' => 'input-text recorder',
      'label' => array(
        'class' => 'inlined',
        'text' => ''
      ),
      'id' => 'VoicenoteEditTitle',
      'placeholder' => 'Title',
      'style' => 'margin-bottom:10px;',
      'onsubmit' => 'return false;'
    ));

    echo $this->Form->input('tags', array(
      'div' => false,
      'class' => 'input-text recorder',
      'id' => 'VoicenoteEditTags',
      'label' => false, 
      'placeholder' => 'Tags',
      'onsubmit' => 'return false;'
    ));
    echo $this->Form->button('Cancel', array(
      'class' => 'button medium blue',
      'id' => 'cancel-edit',
      'style' => 'float:left;margin-top:50px;'
    ));
    echo $this->Form->submit('Save', array(
      'class' => 'button medium blue',
      'id' => 'save-edit',
      'style' => 'float:right;margin-top:50px;'
    ));
  ?> 
  <input type="hidden" id="edit-container-index" value="">
</div>

It's not outputting the <form></form> tags and I have declared my forms this way throughout my app, adding the $this->Form->end() doesn't work either, any clues?

EDIT: explicitly declaring the <form></form> tags does not output them either

EDIT 2: there is something really weird I'm noticing. I have 4 forms on the page with the problem, If I remove the rendering of the element with the problem, another one of my forms wont render, the one right after it.


you have a submit button. just add end() after submit button in your ctp file.

<?php 
echo $this->Form->create('users');
echo $this->Form->input('username');
echo $this->Form->input('password');
echo $this->Form->submit('login');
echo $this->Form->end();
?>


Hi I think if you change last echo to

echo $this->Form->end( array(
  'label'=>'Save',
  'class' => 'button medium blue',
  'id' => 'save-edit',
  'style' => 'float:right;margin-top:50px;'
));

it should work

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号