2011-12-10 49 views
5

我在Cake php中有這個代碼,但它會產生一串標籤以及我不喜歡的輸入。我怎樣才能擺脫它們?我只是想輸入。如何避免輸入標籤

echo $this->Form->hidden('user_role', array('value'=> '2')); 
echo $this->Form->input('user_username'); 
echo $this->Form->input('user_password', array('type' => 'password')); 
echo $this->Form->input('user_fname'); 
echo $this->Form->input('user_lname'); 
echo $this->Form->input('user_email'); 
echo $this->Form->input('user_phone'); 
echo $this->Form->input('user_cellphone'); 
echo $this->Form->input('user_address1'); 
echo $this->Form->input('user_address2'); 
echo $this->Form->input('user_city'); 
echo $this->Form->input('user_zip'); 
echo $this->Form->end('Submit'); 

謝謝

+0

您是否嘗試過諮詢[手冊](http://book.cakephp.org/view/1390/Automagic-Form-Elements)? – deceze

回答

15

標籤是良好的可用性。但是,你可以刪除它們在每個表單字段中添加以下內容:創建窗體時默認

$this->Form->input('user_username', array('label' => false)); 

您還可以禁用標籤:可以在他們的網站上

$this->Form->create('User', array('inputDefaults' => array('label' => false))); 

Futher信息:

+0

一個小問題......我不使用該標籤的原因..是因爲它不允許我定位它..現在標籤和輸入看起來很奇怪,如果一個標籤比其他標籤更長,它就會變得不整齊 – user710502

+0

@user聽起來更像是CSS佈局問題,而不是標籤問題。 – deceze

+0

您必須使用CSS來使您的表單「定位好」。看看這篇文章:http://www.dailycoding.com/Posts/layout_form_without_tables_with_css_trick.aspx – felipecrp