-
-
Save khaledomari87/94b82e181f5710ee7ba3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('INTERNAL', 1); | |
include 'init.php'; | |
require_once('pieforms/pieform.php'); | |
$IJS = <<<EOF | |
function presubmitcallback(form, data) { | |
alert('presubmitcallback'); | |
} | |
function postsubmitcallback(form, data) | |
{ | |
alert('postsubmitcallback'); | |
} | |
function jserrorcallback(form,data) | |
{ | |
alert('jserrorcallback'); | |
} | |
function jssuccesscallback(form,data) | |
{ | |
alert('jssuccesscallback'); | |
} | |
EOF; | |
$elements = array( | |
'firstname'=>array( | |
'type'=>'text', | |
'rules' => array( | |
'required' => true, | |
), | |
'help'=> true, | |
), | |
'submit'=>array( | |
'type'=>'submit', | |
'value'=>'value', | |
), | |
); | |
$pieform = array( | |
'name'=>'moos', | |
'method'=>'post', | |
'action'=>'', | |
'plugintype'=>'qayrwan', | |
'pluginname'=>'moos', | |
'elements' => $elements, | |
'jsForm' => true, | |
'constructorcallback' => 'moos_element_callback', | |
'helpcallback' => 'moos_get_help', | |
'replycallback'=> 'moos_replycallback',///we still don't know how it works | |
'jserrorcallback'=> 'jserrorcallback', | |
'jssuccesscallback' => 'clearPasswords', | |
'presubmitcallback' => 'presubmitcallback', | |
'postsubmitcallback' => 'postsubmitcallback', | |
); | |
function moos_element_callback(&$data) { | |
//function that controls the elemets of the form before it is sent to the user | |
} | |
function moos_replycallback($code, $data){ | |
return 'replycallback';die; | |
} | |
function moos_validate(Pieform $form, $values) | |
{ | |
if($values['firstname']!='s') | |
$form->set_error('firstname','simsim'); | |
} | |
function moos_submit(Pieform $form, $values) | |
{ | |
if ($form->submitted_by_js()) { | |
$form->json_reply($code, $message); | |
} | |
else{ | |
$SESSION->add_error_msg('error message'); | |
redirect('/artefact/internal/'); | |
} | |
// Should never be replying with an array for an OK message | |
} | |
function moos_get_help(Pieform $form, $element){ | |
///qayrwan | |
//moos | |
//lang | |
//en.utf8 | |
//help | |
//formname.elementname.html | |
return get_help_icon('qayrwan','moos','moos','firstname'); | |
} | |
$form = pieform($pieform); | |
$smarty = smarty(); | |
$smarty->assign('INLINEJAVASCRIPT', $IJS); | |
$smarty->assign('form', $form); | |
$smarty->display('form.tpl'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment