Of course other items may be generalized as well. But in effort to generate ideas, here is the class object with public methods.
class GeneralOrderGridInsertEditTemplateMethods
{
public static function GetInsertFormButtons()
{
$jqueryButton = ' <script> '
. '$(function(){ '
. ' $("#BackButton").button(); '
. ' $("#SaveButton").button(); '
. '}); </script> ';
$confirmButton = '
<input type="button" id="SaveButton" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text"
style="color:green; font-size:12px;border-color:green;" aria-disabled="false" onclick="grid_confirm_insert(this)" value="Save" />';
$cancelButton = '
<input type="button" id="BackButton" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text"
style="color:red;font-size:12px;border-color:#F78181;" aria-disabled="false" onclick="grid_cancel_insert(this)" value="Back" />';
return '<table align="right">
<tr>
<td style="padding:5px;">'.$cancelButton.'</td><td>'.$confirmButton.'</td>
</tr>
</table>' . $jqueryButton;
}
public static function GetEditFormButtons()
{
$jqueryButton = ' <script> '
. '$(function(){ '
. ' $("#BackButton").button(); '
. ' $("#SaveButton").button(); '
. '}); </script> ';
$confirmButton = '
<input type="button" id="SaveButton" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text"
style="color:green; font-size:12px;border-color:green;" aria-disabled="false" onclick="grid_confirm_edit(this)" value="Save" />';
$cancelButton = '
<input type="button" id="BackButton" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text"
style="color:red;font-size:12px;border-color:#F78181;" aria-disabled="false" onclick="grid_cancel_edit(this)" value="Back" />';
return '<table align="right">
<tr>
<td style="padding:5px;">'.$cancelButton.'</td><td>'.$confirmButton.'</td>
</tr>
</table>' . $jqueryButton ;
}
}
Here is the usage example.
$buttons = GeneralOrderGridInsertEditTemplateMethods::GetEditFormButtons();
/* Generate your form below, and include the buttons where you like. */