我有一个野外县:
$county = new Select('county');
$county->setAttribute('id', 'county');
$county->setAttribute('class', 'stored');
$county->setAttribute('title', _('web.form.selfService.register.county.title'));
$county->setAttribute('required', 'required');
$county->setEmptyOption(_('web.form.selfService.register.county.emptyOption'));
$county->setValueOptions($this->getDomainValues(Domain::COUNTY));
$county->setLabel(_('web.form.selfService.register.county.label'));
$this->add($county);
当县字段为空并且提交表单时,输出是源文本: web.form.selfService.register.county.title
此外,我在表单中有很多文本字段,其标题被翻译得很好。
示例:
$firstName = new Text('firstName');
$firstName->setAttribute('id', 'firstName');
$firstName->setAttribute('class', 'stored');
$firstName->setAttribute('placeholder', _('web.form.selfService.register.firstName.placeholder'));
$firstName->setAttribute('title', _('web.form.selfService.register.firstName.title'));
$firstName->setAttribute('required', 'required');
$firstName->setLabel(_('web.form.selfService.register.firstName.label'));
$this->add($firstName);
当第一个名字段留空并且表格被提交时,输出将是:
请插入名字