This is a demo profile that you may find on BoonEx.
BoonEx mission is to Unite People and thus make the world a better place.
', 'AU', 'Castle Hill', '1981-03-31', 'boonex, community, unite, people', 10), (47, 'Bimbo', 'bambi@bumba.com', 'Unconfirmed', 1, '', '', '', '', 'Bomba', '0000-00-00', '', 3), (50, 'X-Man', 'x@man.me', 'Unconfirmed', 1, '', '', '', '', 'Movie City', '0000-00-00', '', 10); */ class BxGridMy extends BxTemplGrid { public function __construct ($aOptions, $oTemplate = false) { parent::__construct ($aOptions, $oTemplate); } /** * add js file for AJAX form submission */ protected function _addJsCss() { parent::_addJsCss(); $this->_oTemplate->addJs('jquery.form.min.js'); $oForm = new BxTemplFormView(array()); $oForm->addCssJs(); } /** * 'add' action handler */ public function performActionAdd() { $sAction = 'add'; $aForm = array( 'form_attrs' => array( 'id' => 'sample-add-form', 'action' => 'grid.php?' . bx_encode_url_params($_GET, array('ids', '_r')), // grid.php is usiversal actions handler file, we need to pass object and action names to it at least, or just all the params to preserve such states like filter and paginate 'method' => 'post', ), 'params' => array ( 'db' => array( 'table' => 'sample_grid_data', 'key' => 'ID', 'submit_name' => 'do_submit', ), ), 'inputs' => array( 'NickName' => array( 'type' => 'text', 'name' => 'NickName', 'caption' => _t('Username'), 'required' => true, 'checker' => array( 'func' => 'length', 'params' => array(1, 150), 'error' => _t( 'Username is required' ) ), 'db' => array ( 'pass' => 'Xss', ), ), 'Email' => array( 'type' => 'text', 'name' => 'Email', 'caption' => _t('Email'), 'required' => true, 'checker' => array( 'func' => 'email', 'error' => _t( '_Incorrect Email' ) ), 'db' => array ( 'pass' => 'Xss', ), ), 'City' => array( 'type' => 'text', 'name' => 'City', 'caption' => _t('City'), 'required' => true, 'checker' => array( 'func' => 'length', 'params' => array(1, 150), 'error' => _t( 'City is required' ) ), 'db' => array ( 'pass' => 'Xss', ), ), 'submit' => array( 'type' => 'input_set', 0 => array ( 'type' => 'submit', 'name' => 'do_submit', 'value' => _t('_Submit'), ), 1 => array ( 'type' => 'reset', 'name' => 'close', 'value' => _t('Close'), 'attrs' => array( 'onclick' => "$('.bx-popup-active').dolPopupHide()", 'class' => 'bx-def-margin-sec-left', ), ), ), ), ); $oForm = new BxTemplFormView($aForm); $oForm->initChecker(); if ($oForm->isSubmittedAndValid()) { // if form is submitted and all fields are valid $iNewId = $oForm->insert (array(), true); // insert record to database if ($iNewId) $aRes = array('grid' => $this->getCode(false), 'blink' => $iNewId); // if record is successfully added, reload grid and highlight added row else $aRes = array('msg' => "Error occured"); // if record adding failed, display error message echoJson($aRes); } else { // if form is not submitted or some fields are invalid, display popup with form // we need to use 'transBox' function to properly display 'popup' $s = BxTemplFunctions::getInstance()->transBox('', '->getImageUrl('acl-standard.png') . ')