From a4814b960c7aabf4c6432c122fa0da675d5681b3 Mon Sep 17 00:00:00 2001 From: Jason Woofenden Date: Thu, 21 Dec 2006 23:05:38 -0500 Subject: [PATCH] metaform: added 'int' type, made preview more blatant, and ran the preview through the template engine before displaying --- format.php | 4 ++++ metaform.php | 6 +++++- metaform/preview.html | 4 ++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/format.php b/format.php index 60d0bf0..d5fb32b 100644 --- a/format.php +++ b/format.php @@ -22,6 +22,10 @@ # This file contains basic encodings +function format_int($str) { + return ereg_replace('[^0-9]', '', $str); +} + function format_oneline($str) { $str = str_replace("\r", '', $str); return str_replace("\n", '', $str); diff --git a/metaform.php b/metaform.php index 9bd36cb..1ae9f53 100644 --- a/metaform.php +++ b/metaform.php @@ -30,6 +30,7 @@ $GLOBALS['types'] = array( # type input format sql 'name' => array('textbox', 'oneline', 'varchar(200)'), 'textbox' => array('textbox', 'oneline', 'varchar(200)'), + 'int' => array('textbox', 'int', 'varchar(100)'), 'email' => array('textbox', 'email', 'varchar(100)'), 'phone' => array('textbox', 'phone', 'varchar(32)'), 'money' => array('textbox', 'money', 'varchar(32)'), @@ -234,7 +235,10 @@ function preview() { $tem->load('code/wfpl/metaform/preview.html'); $tem->set('form_name', $GLOBALS['form_name']); $tem->set('fields', $_REQUEST['fields']); - $tem->set('preview', make_template(false)); + $preview_tem = new tem(); + $preview = $preview_tem->run(make_template(false)); + unset($preview_tem); + $tem->set('preview', $preview); set_form_action(); $tem->output(); } diff --git a/metaform/preview.html b/metaform/preview.html index 041cfd8..2d4381a 100644 --- a/metaform/preview.html +++ b/metaform/preview.html @@ -6,8 +6,8 @@ -

Preview

-
+
+

This grey thing is a preview. It will NOT work. Don't click buttons in it

~preview~

-- 1.7.10.4