update 2023-04-10
This commit is contained in:
+17
-7
@@ -3,12 +3,12 @@
|
||||
/*******************************************************************
|
||||
|
||||
Module : /Web/Form.php
|
||||
Desc. : v4 - Form Generator (jQuery & Bootstrap)
|
||||
Desc. : v3 - Form Generator (jQuery & Bootstrap)
|
||||
Created By : Siau Pheng ([email protected]).
|
||||
Created Date : February 27th, 2008.
|
||||
Last Modified : April 17th, 2022.
|
||||
Last Modified : March 24th, 2023.
|
||||
|
||||
(c) 2008 - 2022, 3FONIA Software; WWW.3FONIA.COM.
|
||||
(c) 2008 - 2023, 3FONIA Software; WWW.3FONIA.COM.
|
||||
|
||||
*******************************************************************/
|
||||
|
||||
@@ -44,7 +44,7 @@ final class Form {
|
||||
}
|
||||
$tout .= '<option value="'.$key.'"'.$olabel;
|
||||
$aval = array($tvalue);
|
||||
if ($bmulti==true) $aval = explode(",", $tvalue);
|
||||
if ($bmulti==true) $aval = explode(",", ($tvalue ?? "0"));
|
||||
$tout .= (in_array($key, $aval)) ? ' selected="selected"' : "";
|
||||
$tout .= '>'.$_val2.'</option>';
|
||||
}
|
||||
@@ -131,7 +131,7 @@ final class Form {
|
||||
$bhasil = ((is_string($tvalue) && in_array($tvalue,array("N","T","0"))) or (is_numeric($tvalue) && $tvalue==0) or (is_bool($tvalue) && $tvalue===false) or empty($tvalue)) ? true : false;
|
||||
$_enab = ($benable==true) ? "" : ' disabled=true';
|
||||
$_req = ($breq==true) ? " required=true" : "";
|
||||
$_change = ($tchange==null) ? ' onchange="this.value=(this.checked)?\''.$avalue[0].'\':\''.$avalue[1].'\';"' : ' onchange="this.value=(this.checked)?\''.$avalue[0].'\':\''.$avalue[1].'\';'.$tchange.'"';
|
||||
$_change = ' onchange="this.value=(this.checked)?\''.$avalue[0].'\':\''.$avalue[1].'\';'.($tchange==null?'':$tchange).'"';
|
||||
$tout = '<div class="form-check form-check-inline mr-1"><input type="checkbox" class="form-check-input" id="'.$tfield.'" name="'.$tfield.'" value="'.($bhasil?$avalue[1]:$avalue[0]).'"'.$_enab.$_change.$_req;
|
||||
$tout .= ($bhasil==false) ? ' checked="checked"' : '';
|
||||
$tout .= '></div>';
|
||||
@@ -203,7 +203,17 @@ final class Form {
|
||||
return $tout;
|
||||
}
|
||||
|
||||
public function textauto($tlabel="", $tfield, $tvalue=null, $benable=true, $breq=false, $holdtxt=null, $nmaxsize=null, $thelp="") {
|
||||
public function textauto($tlabel="", $tfield, $avalue=['value'=>0,'text'=>""], $benable=true, $breq=false, $holdtxt=null, $nmaxsize=null, $thelp="") {
|
||||
$_enab = ($benable==true) ? "" : ' disabled=true';
|
||||
$_req = ($breq==true) ? " required=true" : "";
|
||||
$_max = ($nmaxsize==null) ? "" : ' maxlength="'.$nmaxsize.'"';
|
||||
$_holdtxt = ($holdtxt==null) ? "" : ' placeholder="'.$holdtxt.'"';
|
||||
$tout = '<input type="search" class="form-control" id="'.$tfield.'" name="'.$tfield.'" value="'.$avalue['text'].'"'.$_enab.$_max.$_holdtxt.$_req.' autocomplete="off" />';
|
||||
$this->__aform[$tfield] = array('label'=>$tlabel, 'help'=>$thelp, 'form'=>$tout);
|
||||
return $tout;
|
||||
}
|
||||
|
||||
/*public function textauto($tlabel="", $tfield, $tvalue=null, $benable=true, $breq=false, $holdtxt=null, $nmaxsize=null, $thelp="") {
|
||||
$tvalue = ($tvalue==null) ? array('value'=>0, 'text'=>"") : $tvalue;
|
||||
$_enab = ($benable==true) ? "" : ' disabled=true';
|
||||
$_req = ($breq==true) ? " required=true" : "";
|
||||
@@ -212,7 +222,7 @@ final class Form {
|
||||
$tout = '<select class="form-control" id="'.$tfield.'" name="'.$tfield.'" default-value="'.$tvalue['value'].'" default-text="'.$tvalue['text'].'"'.$_enab.$_max.$_holdtxt.$_req.' /></select>';
|
||||
$this->__aform[$tfield] = array('label'=>$tlabel, 'help'=>$thelp, 'form'=>$tout);
|
||||
return $tout;
|
||||
}
|
||||
}*/
|
||||
|
||||
public function datebox($tlabel="", $tfield, $tvalue=null, $benable=true, $breq=false, $thelp="", $tkeyup=null, $tblur=null) {
|
||||
if ($tvalue<>null) $tvalue = tgl_sql2str($tvalue);
|
||||
|
||||
Reference in New Issue
Block a user