0

I am using cakePHP 1.26. I am sorry to ask this question, but I couldn't work out how to use the cakePHP built-in FORM helper to generate the code like these two:

<input type="text" name="data[Test][quote]" id="data[Test][quote]" size="12" style="font-family:Arial" value="helloworld" readonly>

<input type="hidden" name="data[Test][quote]" id="data[Test][quote]" value="helloworld">

Could you help me please?

4

1 回答 1

1

尝试这个:

<?php
 echo $form->input( 'Test.quote', array( 'type' => 'hidden', 'value' => 'helloworld' ) );
 echo $form->input( 'Test.quote', array( 'type' => text', 'size' => 12, 'style' => 'font-family:Arial', 'value' => 'helloworld', 'readonly' => 'readonly' ) );
?>

如果您将它们放在同一个页面上,使用相同的名称,请确保将隐藏的输入放在文本之前。这样,如果有人在字段中输入内容,文本输入将覆盖隐藏的输入。

于 2010-07-11T19:20:32.413 回答