当前位置: 首页>>代码示例>>PHP>>正文


PHP sfForm::renderHiddenFields方法代码示例

本文整理汇总了PHP中sfForm::renderHiddenFields方法的典型用法代码示例。如果您正苦于以下问题:PHP sfForm::renderHiddenFields方法的具体用法?PHP sfForm::renderHiddenFields怎么用?PHP sfForm::renderHiddenFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sfForm的用法示例。


在下文中一共展示了sfForm::renderHiddenFields方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sfWidgetFormSchemaFormatterList

$t->is($f->getWidgetSchema()->getFormFormatterName(), 'table', 'renderUsing() does not persist form formatter name for the current form instance');
$w = $f->getWidgetSchema();
$w->addFormFormatter('custom', new sfWidgetFormSchemaFormatterList($w));
$t->is($f->renderUsing('custom'), fix_linebreaks($output), 'renderUsing() renders a custom form formatter');
try {
    $f->renderUsing('nonexistant');
    $t->fail('renderUsing() throws an exception if formatter name does not exist');
} catch (InvalidArgumentException $e) {
    $t->pass('renderUsing() throws an exception if formatter name does not exist');
}
// renderHiddenFields()
$t->diag('->renderHiddenFields()');
$f = new sfForm();
$f->setWidgets(array('id' => new sfWidgetFormInputHidden(), 'name' => new sfWidgetFormInputText(), 'is_admin' => new sfWidgetFormInputHidden()));
$output = '<input type="hidden" name="id" id="id" /><input type="hidden" name="is_admin" id="is_admin" />';
$t->is($f->renderHiddenFields(), $output, 'renderHiddenFields() renders all hidden fields, no visible fields');
$t->is(count($f->getFormFieldSchema()), 3, 'renderHiddenFields() does not modify the form fields');
$author = new sfForm();
$author->setWidgets(array('id' => new sfWidgetFormInputHidden(), 'name' => new sfWidgetFormInputText()));
$company = new sfForm();
$company->setWidgets(array('id' => new sfWidgetFormInputHidden(), 'name' => new sfWidgetFormInputText()));
$author->embedForm('company', $company);
$output = '<input type="hidden" name="id" id="id" /><input type="hidden" name="company[id]" id="company_id" />';
$t->is($author->renderHiddenFields(), $output, 'renderHiddenFields() renders hidden fields from embedded forms');
$output = '<input type="hidden" name="id" id="id" />';
$t->is($author->renderHiddenFields(false), $output, 'renderHiddenFields() does not render hidden fields from embedded forms if the first parameter is "false"');
// ->embedForm()
$t->diag('->embedForm()');
$author = new FormTest(array('first_name' => 'Fabien'));
$author->setWidgetSchema($author_widget_schema = new sfWidgetFormSchema(array('first_name' => new sfWidgetFormInputText())));
$author->setValidatorSchema($author_validator_schema = new sfValidatorSchema(array('first_name' => new sfValidatorString(array('min_length' => 2)))));
开发者ID:Tony-M,项目名称:GrannySymfony,代码行数:31,代码来源:sfFormTest.php

示例2: button_to

} else {
    echo button_to(__('Generate consumer secret'), '@op_opensocial_update_consumer_secret?id=' . $application->getId());
}
?>

</td></tr>
<tr><th>Signature method</th><td>HMAC-SHA1</td></tr>
<tr><td colspan="2">
<?php 
echo button_to(__('Delete'), '@op_opensocial_delete?id=' . $sf_request->getParameter('id'), array('style' => 'float:left'));
?>
 
<?php 
$form = new sfForm();
echo $form->renderFormTag(url_for('@op_opensocial_update?id=' . $sf_request->getParameter('id')), array('style' => 'float:left'));
echo $form->renderHiddenFields();
?>
<input type="submit" value="<?php 
echo __('Update');
?>
" />
</form>
<?php 
if ($application->isActive()) {
    echo $form->renderFormTag(url_for('@op_opensocial_inactivate?id=' . $sf_request->getParameter('id')));
    echo $form->renderHiddenFields();
    ?>
<input type="submit" value="<?php 
    echo __('Inactivate');
    ?>
" />
开发者ID:rysk92,项目名称:opOpenSocialPlugin,代码行数:31,代码来源:infoSuccess.php


注:本文中的sfForm::renderHiddenFields方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。