我试图有一个复选框“同意TOS”.
如果未选中复选框,我想放出一个Flash消息.
我该怎么做?
我的看法:
<?PHP echo $form->create('Item',array('url' => array_merge(array('action' => 'find'),$this->params['pass']))); echo $form->input('Search',array('div' => false)); echo $form->submit(__('Search',true),array('div' => false)); echo $form->checkBox('tos',array('label' => false,'value'=>1)).' Agree TOS'; echo $form->error('tos'); echo $form->end(); ?>
我的型号:
var $check = array( 'tos' => array( 'rule' => array('comparison','equal to',1),'required' => true,'allowEmpty' => false,'on' => 'index','message' => 'You have to agree TOS' ));
这似乎适合我.希望会有所帮助.
原文链接:https://www.f2er.com/php/132229.html型号:
'tos' => array( 'notEmpty' => array( 'rule' => array('comparison','!=',0),'message' => 'Please check this Box if you want to proceed.' )
看来:
<?PHP echo $this->Form->input('tos',array('type'=>'checkBox','label'=>__('I confirm I have read the <a href="/privacy-statement">privacy statement</a>.','hiddenField' => false,'value' => '0')); ?>