私はZF2を使用していますが、私のフィールドのいくつかは、デザインのために慣習的に作成されています。zendフォームを介して作成されるものはほとんどありません。データを投稿すると、ZF2フォームを介して作成された投稿済みフィールド(ユーザー名フィールド、性別、タイトルなど)のみが取得されます。残りのフィールドは投稿されません。これが私のコードの抜粋です
<?php
$form = $this->form;
$form->prepare();
echo $this->form()->openTag($form);
?>
<div class="featureBox">
<div class="profile_address">
<div class="main">
<div class="address_head"><h4><?php echo $form->get('username')->getValue(); ?> > Account Detail</h4></div>
<div class="field_set">
<div class="field_input">
<label><?php echo $form->get('username')->getLabel(); ?></label>
<div class="field"><input type="text" readonly="readonly"value="<?php echo $form->get('username')->getValue(); ?>"></div>
</div>
<div class="field_input">
<label><?php echo $form->get('email')->getLabel(); ?></label>
<div class="field"><input type="text" value="<?php echo $form->get('email')->getValue(); ?>"></div>
</div>
</div>
</div>
<div class="field_set">
<div class="field_input">
<?php echo $this->formRow($form->get('gender')->setAttribute('class', 'stylish-select')); ?>
</div>
</div>
<div class="field_set">
<div class="field_input">
<?php echo $this->formRow($form->get('title')); ?>
</div>
</div>
<div class="free-btn">
<input type="submit" value="Save" onclick="return validatePassword();"/>
<input type="button" value="Back" class="button" onclick="window.location='<?php echo $this->url('admin_administrator'); ?>';return false;" />
</div>
</div>
</div>
</div>
<?php
$this->form()->closeTag();
?>
何が間違っているのかについてのアイデアは、私が使用すればこれを克服することができます
$ this-> formRow()
すべてのフィールドで使用できますが、これを使用すると、設計要件が台無しになります。