From fe1d6175a746734bab6a43c41007b668d228aa23 Mon Sep 17 00:00:00 2001 From: tombrain Date: Sun, 5 Nov 2023 21:00:43 +0100 Subject: [PATCH] new --- tests/htmlTests/dbFormhandler_DateField.php | 43 +++++++++++++++++++++ tests/htmlTests/formhandler_TimeField.php | 35 +++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 tests/htmlTests/dbFormhandler_DateField.php create mode 100644 tests/htmlTests/formhandler_TimeField.php diff --git a/tests/htmlTests/dbFormhandler_DateField.php b/tests/htmlTests/dbFormhandler_DateField.php new file mode 100644 index 0000000..96425ff --- /dev/null +++ b/tests/htmlTests/dbFormhandler_DateField.php @@ -0,0 +1,43 @@ + + + + + + + + + dbInfo("formhandler", "test", "mysqli"); + $form->dbConnect("localhost", "formhandler", "formhandler"); + + $form->dateField("DateField", "datefield"); + $form->dateField("DateField1", "datefield1", null, true); + $form->dateField("DateField2", "datefield2", null, true, "D-M-Y"); + $form->dateField("DateField3", "datefield3", null, null, "D-M-Y"); + $form->dateField("DateField4", "datefield4", null, false, "D-M-Y"); + + // submitbutton + $form->submitButton("Save"); + + // set the onCorrect function + $form->onCorrect("doRun"); + + // flush + $form->flush(); + + // commit after form function + function doRun($data) + { + echo print_r($data); + } diff --git a/tests/htmlTests/formhandler_TimeField.php b/tests/htmlTests/formhandler_TimeField.php new file mode 100644 index 0000000..2c5df06 --- /dev/null +++ b/tests/htmlTests/formhandler_TimeField.php @@ -0,0 +1,35 @@ + + + + + + + + + timeField("Time", "time"); + $form->timeField("Time2", "time2", required: true); + + $form->flush(); + + function mOnCorrect(array $fields, FormHandler $fh) + { + var_dump($fields); + var_dump($fh); + } + + // function to show a message + function doRun($data) + { + return print_r($data); + }