Skip to content

Commit

Permalink
Added DECIMAL DATE and DATETIME fields. So you get a nice datepicker
Browse files Browse the repository at this point in the history
etc. in the ADD NEW RECORD and UPDATE forms.
  • Loading branch information
jan-vandenberg committed Sep 15, 2021
1 parent 161c77f commit 84f29ae
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions core/generate.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@ function column_type($columnname){
case (preg_match("/int/i", $columnname) ? true : false) :
return 5;
break;
case (preg_match("/decimal/i", $columnname) ? true : false) :
return 6;
break;
case (preg_match("/datetime/i", $columnname) ? true : false) :
return 8;
break;
case (preg_match("/date/i", $columnname) ? true : false) :
return 7;
break;
default:
return 0;
break;
Expand Down Expand Up @@ -473,6 +482,31 @@ function generate($postdata) {
</div>';
break;

//DECIMAL
case 6:
$create_html [] = '<div class="form-group">
<label>'.$columndisplay.'</label>
<input type="number" name="'. $columnname .'" class="form-control" value="<?php echo '. $create_record. '; ?>" step="any">
<span class="form-text"><?php echo ' . $create_err_record . '; ?></span>
</div>';
break;
//DATE
case 7:
$create_html [] = '<div class="form-group">
<label>'.$columndisplay.'</label>
<input type="date" name="'. $columnname .'" class="form-control" value="<?php echo '. $create_record. '; ?>">
<span class="form-text"><?php echo ' . $create_err_record . '; ?></span>
</div>';
break;
//DATETIME
case 8:
$create_html [] = '<div class="form-group">
<label>'.$columndisplay.'</label>
<input type="datetime-local" name="'. $columnname .'" class="form-control" value="<?php echo date("Y-m-d\TH:i:s", strtotime('. $create_record. ')); ?>">
<span class="form-text"><?php echo ' . $create_err_record . '; ?></span>
</div>';
break;

default:
$create_html [] = '<div class="form-group">
<label>'.$columndisplay.'</label>
Expand Down

0 comments on commit 84f29ae

Please sign in to comment.