gpt4 book ai didi

css - cakePHP 内联显示表单元素

转载 作者:行者123 更新时间:2023-12-02 22:43:02 25 4
gpt4 key购买 nike

我正在尝试显示使用 cakePHP 表单助手构建的内联表单元素。它似乎与它围绕元素创建的类有关。我确信这可以用 CSS 解决,但如果有其他方法,我宁愿这样做:

<?php
echo $this->Form->create("users");
echo $this->Form->input("username",array("label" => false, "class" => false, "value" => "Username", "class" => "loginCredentials"));
echo $this->Form->input("password",array("label" => false, "class" => false, "value" => "Password", "class" => "loginCredentials"));
echo $this->Form->input("loginBtn",array("label" => false, "class" => false, "value" => "LOGIN", "class" => "loginCredentials", "type" => "submit"));
echo $this->Form->end();
?>

最佳答案

默认情况下,CakePHP 将 <div>围绕输入。您可以添加 'div'=>false每个输入的选项:

echo $this->Form->input("username",array("label" => false, "div"=>false, "class" => false, "value" => "Username", "class" => "loginCredentials"));

或者,您可以为表单本身设置 inputDefaults:

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

关于css - cakePHP 内联显示表单元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10472998/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com