本文整理汇总了PHP中YDForm::tohtml方法的典型用法代码示例。如果您正苦于以下问题:PHP YDForm::tohtml方法的具体用法?PHP YDForm::tohtml怎么用?PHP YDForm::tohtml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类YDForm
的用法示例。
在下文中一共展示了YDForm::tohtml方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionDefault
function actionDefault()
{
// create a form with a span and a button
$form = new YDForm('myform');
$form->addElement('span', 'myspanresult', ' ', array('style' => 'BACKGROUND-COLOR:#ccccff'));
$form->addElement('button', 'mybutton', 'Get version');
// create ajax object
$this->ajax = new YDAjax($this->tpl, $form);
// create custom effects for waiting message
$onStart = new YDAjaxEffect('', 'opacity', 'hide()', 0);
$onShow = new YDAjaxEffect('', 'opacity', 'custom(0,1)', 0);
$onHide = new YDAjaxEffect('', 'opacity', "toggle()");
// use waiting message with custom effects
$this->ajax->useWaitingMessage("<h2> Please wait ... <\\/h2>", array(), $onStart, $onShow, $onHide);
// to use default waiting message just try:
// $this->ajax->useWaitingMessage();
// register element mybutton (mybutton will be assigned with 'getversion' call in the client side)
$this->ajax->addEvent('mybutton', array(&$this, 'getversion'));
// process ajax events
$this->ajax->processEvents();
// assign form and display template
$this->tpl->assign('title', 'This example demonstrates the waiting message with custom parameters');
$this->tpl->assign('form', $form->tohtml());
$this->tpl->display('general');
}
示例2: actionDefault
function actionDefault()
{
// create a form with a 2 autocompleters and a simple text element
$form = new YDForm('myform');
$form->addElement('autocompleter', 'arg1', 'Country with standard style:', '', array(&$this, 'getCountry'));
$form->addElement('text', 'arg2', 'Just a simple text box without autocompleter');
$form->addElement('autocompleter', 'arg3', 'Country with custom style:', array('style' => 'width:300px; background-color:#CCFFFF;'), array(&$this, 'getCountry'));
// create ajax object
$this->ajax = new YDAjax($this->tpl, $form);
// process events added
$this->ajax->processEvents();
// assign form and display template
$this->tpl->assign('title', 'Just start typing a coutry name in the box to see the effect');
$this->tpl->assign('form', $form->tohtml());
$this->tpl->display();
}
示例3: actionDefault
function actionDefault()
{
// create a form with a span and a button
$form = new YDForm('myform');
$form->addElement('span', 'myspanresult', ' ', array('style' => 'BACKGROUND-COLOR:#ccccff'));
// create ajax object
$this->ajax = new YDAjax($this->tpl, $form);
// register custom function
$this->ajax->addEvent('customFunction()', array(&$this, 'getversion'));
// process ajax events
$this->ajax->processEvents();
// assign form and display template
$this->tpl->assign('title', 'This is a simple ajax example');
$this->tpl->assign('form', $form->tohtml());
$this->tpl->display();
}
示例4: actionDefault
function actionDefault()
{
// create a form with a span and a button
$form = new YDForm('myform');
$form->addElement('span', 'myspanresult', ' ', array('style' => 'BACKGROUND-COLOR:#ccccff'));
$form->addElement('button', 'mybutton', 'Get YDFramework version');
// create ajax object
$this->ajax = new YDAjax($this->tpl, $form);
// register element mybutton (mybutton will be assigned with 'getversion' call in the client side)
$this->ajax->addEvent('mybutton', array(&$this, 'getversion'));
// process ajax events
$this->ajax->processEvents();
// assign form and display template
$this->tpl->assign('title', 'This is a simple ajax example');
$this->tpl->assign('form', $form->tohtml());
$this->tpl->display('general');
}
示例5: actionDefault
function actionDefault()
{
// create a form with a span and two buttons
$form = new YDForm('myform');
$form->addElement('span', 'myspanresult', ' ', array('style' => 'WIDTH:350px;BACKGROUND-COLOR:#ccccff'));
$form->addElement('button', 'mybutton', 'Get YDFramework version');
$form->addElement('button', 'mybutton2', 'Get time');
// create ajax object
$this->ajax = new YDAjax($this->tpl, $form);
// register element mybutton with event result and fixed argument '1' and mybutton2 with event 'result' with argument 2
$this->ajax->addEvent('mybutton', array(&$this, 'result'), 1);
$this->ajax->addEvent('mybutton2', array(&$this, 'result'), 2);
// process events added
$this->ajax->processEvents();
// assign form and display template
$this->tpl->assign('title', 'This is a two buttons example with a different event assigned for each one');
$this->tpl->assign('form', $form->tohtml());
$this->tpl->display('general');
}
示例6: actionDefault
function actionDefault()
{
// create a form with a 2 texts, a button and a span for result
$form = new YDForm('myform');
$form->addElement('text', 'arg1', 'X:');
$form->addElement('text', 'arg2', 'Y:');
$form->addElement('button', 'mybutton', 'Sum');
$form->addElement('span', 'myspanresult', ' ');
// create ajax object
$this->ajax = new YDAjax($this->tpl, $form);
// assign 'mybutton' with 'compute' call with dynamic values from form elements 'arg1' and 'arg2'
$this->ajax->addEvent('mybutton', array(&$this, 'compute'), array('arg1', 'arg2'));
// process events added
$this->ajax->processEvents();
// assign form and display template
$this->tpl->assign('title', 'This a calculator example. Fill X and Y');
$this->tpl->assign('form', $form->tohtml());
$this->tpl->display('general');
}
示例7: actionDefault
function actionDefault()
{
// create a form with a 2 texts, a select to choose operation, a button and a span for result
$form = new YDForm('myform');
$form->addElement('text', 'arg1', 'X:');
$form->addElement('select', 'operation', 'Operation', array(), array(0 => '+', '-', 'x', '/'));
$form->addElement('text', 'arg2', 'Y:');
$form->addElement('span', 'myspanresult', ' ');
$form->addElement('button', 'mybutton', 'Calc');
// create ajax object
$this->ajax = new YDAjax($this->tpl, $form);
// assign 'mybutton' with 'compute' call with dynamic values from form elements 'arg1', 'arg2' and 'operation'
$this->ajax->addEvent('mybutton', array(&$this, 'compute'), array('arg1', 'arg2', 'operation'));
// process events added
$this->ajax->processEvents();
// assign form and display template
$this->tpl->assign('title', 'This a dynamic calculator example (you can choose operation)');
$this->tpl->assign('form', $form->tohtml());
$this->tpl->display('general');
}
示例8: actionDefault
function actionDefault()
{
// create a form with a span and a button
$form = new YDForm('myform');
$form->addElement('span', 'myspanresult', ' ', array('style' => 'WIDTH:350px;BACKGROUND-COLOR:#ccccff'));
$form->addElement('button', 'mybutton', 'Get YDFramework version');
// create ajax object
$this->ajax = new YDAjax($this->tpl, $form);
// register element mybutton (mybutton will be assigned with 'getversion' call in the client side)
$this->ajax->addEvent('mybutton', array(&$this, 'getversion'));
// add confirmation to mybutton call
$this->ajax->addConfirmation('mybutton', 'Are you shure you want to get ydf version?');
// create an alias (submitCall). you can see a new function submitCall() is js client code
// note that, addAlias is defined AFTER addConfirmation, then submitCall() will have confirmation too
// alias BEFORE addConfirmation will assign submitCall() with a clean event
$this->ajax->addAlias('mybutton', 'submitCall()');
// process ajax events
$this->ajax->processEvents();
// assign form and display template
$this->tpl->assign('title', 'This demonstrates how to add confirmations and aliases');
$this->tpl->assign('form', $form->tohtml());
$this->tpl->display('general');
}