本文整理汇总了PHP中Varien_Data_Form::setOnsubmit方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Data_Form::setOnsubmit方法的具体用法?PHP Varien_Data_Form::setOnsubmit怎么用?PHP Varien_Data_Form::setOnsubmit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Data_Form
的用法示例。
在下文中一共展示了Varien_Data_Form::setOnsubmit方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _prepareForm
/**
* Preperation of current form
*
* @return Mageplace_Backup_Block_Adminhtml_Profile_Create_Form
*/
protected function _prepareForm()
{
$model = Mage::registry('mpbackup_backup');
$id = $model->getId();
$form = new Varien_Data_Form();
$fieldset = $form->addFieldset('base_fieldset', array('legend' => $this->__('Backup Details'), 'class' => 'fieldset-wide'));
$fieldset->addField('profile_id', 'select', array('name' => 'profile_id', 'label' => $this->__('Profile'), 'title' => $this->__('Profile'), 'required' => true, 'disabled' => $id ? true : false, 'values' => $this->_getProfilesForForm(), 'onchange' => 'mpbackup.changeProfile();'));
$fieldset->addField('backup_name', 'text', array('name' => 'backup_name', 'label' => $this->__('Backup Name'), 'title' => $this->__('Backup Name'), 'note' => $this->__("If empty, random file name will be generated.")));
if (!$id) {
$fieldset->addField('backup_filename', 'text', array('name' => 'backup_filename', 'label' => $this->__('Backup File Name Prefix'), 'title' => $this->__('Backup File Name Prefix')));
}
$fieldset->addField('backup_description', 'textarea', array('name' => 'backup_description', 'label' => $this->__('Backup Description'), 'title' => $this->__('Backup Description')));
if (!$id) {
$fieldset->addField('backup_files', 'hidden', array('name' => 'backup_files'));
if (!$this->isLogDisable()) {
$fieldset_progress = $form->addFieldset('progress_fieldset', array('legend' => $this->__('Progress of the backup process'), 'class' => 'fieldset-wide'));
$fieldset_progress->addField('progress_area', 'note', array('name' => 'progress_area', 'label' => $this->__('Backup Progress'), 'title' => $this->__('Backup Progress'), 'text' => '<div id="' . $this->getParentBlock()->getProgressAreaName() . '" style="width:100%; height:350px; overflow:auto;"></div>'));
}
} else {
$fieldset_progress = $form->addFieldset('bufiles_fieldset', array('legend' => $this->__('Backup files'), 'class' => 'fieldset-wide'));
if ($files = $model->getBackupFiles()) {
$fieldset_progress->addField('files_area', 'note', array('name' => 'files_area', 'label' => $this->__('Local Files'), 'title' => $this->__('Local Files'), 'text' => implode('<br />', explode(';', $files))));
}
if ($log_file = $model->getBackupLogFile()) {
$fieldset_progress->addField('log_file_area', 'note', array('name' => 'log_file_area', 'label' => $this->__('Log File'), 'title' => $this->__('Log File'), 'text' => $log_file));
}
if ($cloud_files = $model->getBackupCloudFiles()) {
$fieldset_progress->addField('cloud_files_area', 'note', array('name' => 'cloud_files_area', 'label' => $this->__('Cloud Server Files'), 'title' => $this->__('Cloud Server Files'), 'text' => implode('<br />', explode(';', $cloud_files))));
}
$fieldset_log = $form->addFieldset('log_fieldset', array('legend' => $this->__('Backup logs'), 'class' => 'fieldset-wide'));
if ($errors = $model->getBackupErrors()) {
$fieldset_log->addField('errors_area', 'note', array('name' => 'errors_area', 'label' => $this->__('Backup Errors'), 'title' => $this->__('Backup Errors'), 'text' => $errors));
}
if (($log_file_path = $model->getBackupLogFile()) && file_exists($this->getProfile()->getData('profile_log_path') . DS . $log_file_path)) {
$fieldset_log->addField('logs_area', 'textarea', array('name' => 'logs_area', 'label' => $this->__('Backup Log'), 'title' => $this->__('Backup Log'), 'disabled' => 1));
$model->setData('logs_area', @file_get_contents($this->getProfile()->getData('profile_log_path') . DS . $log_file_path));
}
$fieldset->addField('backup_id', 'hidden', array('name' => 'backup_id'));
}
$form->setValues($model->getData());
$form->setUseContainer(true);
$form->setId($this->getParentBlock()->getFormId());
$form->setMethod('post');
$form->setAction($this->getSaveUrl());
if (!$id) {
$form->setOnsubmit($this->getParentBlock()->getStartJSFunction());
}
$this->setForm($form);
return parent::_prepareForm();
}
示例2: _prepareForm
/**
* Prepares attribute set form
*
*/
protected function _prepareForm()
{
$data = Mage::getModel('eav/entity_attribute_set')->load($this->getRequest()->getParam('id'));
$form = new Varien_Data_Form();
$fieldset = $form->addFieldset('set_name', array('legend' => Mage::helper('catalog')->__('Edit Set Name')));
$fieldset->addField('attribute_set_name', 'text', array('label' => Mage::helper('catalog')->__('Name'), 'note' => Mage::helper('catalog')->__('For internal use.'), 'name' => 'attribute_set_name', 'required' => true, 'class' => 'required-entry validate-no-html-tags', 'value' => $data->getAttributeSetName()));
if (!$this->getRequest()->getParam('id', false)) {
$fieldset->addField('gotoEdit', 'hidden', array('name' => 'gotoEdit', 'value' => '1'));
$sets = Mage::getModel('eav/entity_attribute_set')->getResourceCollection()->setEntityTypeFilter(Mage::registry('entityType'))->load()->toOptionArray();
$fieldset->addField('skeleton_set', 'select', array('label' => Mage::helper('catalog')->__('Based On'), 'name' => 'skeleton_set', 'required' => true, 'class' => 'required-entry', 'values' => $sets));
}
$form->setMethod('post');
$form->setUseContainer(true);
$form->setId('set_prop_form');
$form->setAction($this->getUrl('*/*/save'));
$form->setOnsubmit('return false;');
$this->setForm($form);
}
示例3: _prepareForm
/**
* Prepares attribute set form
*
*/
protected function _prepareForm()
{
$widget = $this->getWidget();
$form = new Varien_Data_Form();
$formLabel = Mage::helper('magemonitoring')->__('Widget Config');
if ($widget) {
$formLabel = $widget->getName() . ' - ' . $formLabel;
}
$fieldset = $form->addFieldset('widget_config', array('legend' => $formLabel));
if ($widget) {
$fieldParams = array('label' => Mage::helper('magemonitoring')->__('Tab Id'), 'name' => 'widget_id', 'required' => true, 'disabled' => true, 'class' => 'required-entry validate-no-html-tags', 'value' => $this->getTabId());
$fieldset->addField('tab_id', 'text', $fieldParams);
$fieldParams['name'] = 'widget_id';
$fieldParams['disabled'] = false;
$fieldParams['label'] = Mage::helper('magemonitoring')->__('Widget Id');
$fieldParams['value'] = $widget->getConfigId();
$fieldset->addField('widget_id', 'text', $fieldParams);
$fieldParams['name'] = 'class_name_display';
$fieldParams['disabled'] = true;
$fieldParams['label'] = Mage::helper('magemonitoring')->__('Class');
$fieldParams['value'] = $widget->getId();
$fieldset->addField('class_name_display', 'text', $fieldParams);
$fieldset->addField('class_name', 'hidden', array('name' => 'class_name', 'value' => $widget->getId()));
$fieldset->addField('widget_id_org', 'hidden', array('name' => 'widget_id_org', 'value' => $this->getWidgetIdOrg()));
foreach ($widget->getConfig() as $k => $c) {
if (is_numeric($k)) {
// add a custom header @todo looks fugly
$fieldset->addField($k, 'text', array('label' => '', 'name' => $k, 'disabled' => true, 'value' => Mage::helper('magemonitoring')->__($c['label'])));
continue;
}
if ($k === 'display_prio') {
continue;
}
$cssClasses = 'validate-no-html-tags';
if ($c['required'] === true) {
$cssClasses .= ' required-entry';
}
$fieldParams = array('label' => Mage::helper('magemonitoring')->__($c['label']), 'note' => Mage::helper('magemonitoring')->__($c['tooltip']), 'name' => $k, 'required' => $c['required'], 'class' => $cssClasses, 'value' => $c['value']);
switch ($c['type']) {
case 'text':
break;
case 'checkbox':
$fieldParams['checked'] = $c['value'] ? true : false;
break;
}
$fieldset->addField($k, $c['type'], $fieldParams);
}
$postUrl = Mage::helper('magemonitoring')->getWidgetUrl('*/widgetAjax/saveWidgetConf', $widget);
$this->setChild('form_after', $this->getLayout()->createBlock('adminhtml/widget_button')->setData(array('label' => Mage::helper('magemonitoring')->__('Save'), 'onclick' => 'saveWidgetConfig(\'' . $postUrl . '\')', 'class' => 'save')));
} else {
$fieldset->addField('edit_widget_form_help', 'text', array('label' => '', 'name' => 'edit_widget_form_help', 'disabled' => true, 'value' => Mage::helper('magemonitoring')->__("Select a widget in the tab tree.")));
}
$form->setId('widget_conf_form');
$form->setMethod('post');
$form->setAction('#');
$form->setUseContainer(true);
$form->setOnsubmit('return false;');
$this->setForm($form);
}