From 68b1b4aa2b9362df65a2f57d06634aedd85aa65d Mon Sep 17 00:00:00 2001 From: Jason Woofenden Date: Sun, 31 Dec 2006 01:11:45 -0500 Subject: [PATCH] metaform supports password and hidden fields varibles from form are much more accessible now set up to be used from run.php if available --- metaform.php | 11 +++++-- metaform/template.html | 6 ++-- metaform/template.php | 83 +++++++++++++++++++++++++++--------------------- 3 files changed, 59 insertions(+), 41 deletions(-) diff --git a/metaform.php b/metaform.php index d8cc07e..2adf13b 100644 --- a/metaform.php +++ b/metaform.php @@ -36,6 +36,8 @@ $GLOBALS['types'] = array( 'money' => array('textbox', 'money', 'varchar(32)'), 'dollars' => array('textbox', 'dollars', 'varchar(32)'), 'url' => array('textbox', 'url', 'varchar(200)'), + 'hidden' => array('hidden', 'unix', 'varchar(200)'), + 'password' => array('password', 'oneline', 'varchar(200)'), 'textarea' => array('textarea', 'unix', 'text'), 'pulldown' => array('pulldown', 'options', 'int'), 'checkbox' => array('checkbox', 'yesno', 'int'), @@ -156,7 +158,9 @@ function make_template($whole_file = true) { $tem->set('name', $name); $tem->set('caption', $name); # fixme $tem->sub($input); - $tem->sub('row'); + if($input != 'hidden') { + $tem->sub('row'); + } } $tem->set('name', 'save'); $tem->set('caption', 'Save'); @@ -182,6 +186,7 @@ function make_php() { $tem->set('form_name', $GLOBALS['form_name']); $fields = get_fields(); $db_fields = ''; + $php_fields = ''; $always_field = false; foreach($fields as $field) { list($name, $type, $input, $format, $sql) = $field; @@ -190,9 +195,10 @@ function make_php() { $tem->set('name', $name); $tem->set('db_field', ''); # we don't want to use the value from last time if($sql != 'n/a') { - $tem->sub('db_field'); if($db_fields != '') $db_fields .= ','; $db_fields .= $name; + if($php_fields != '') $php_fields .= ', '; + $php_fields .= '$' . $name; } $tem->sub('formats'); if(!$always_field and $input != 'checkbox' and $input != 'radio') { @@ -203,6 +209,7 @@ function make_php() { # always_field is a form field that always submits (unlike say, checkboxes). It's used to detect if the form has submitted or not. $tem->set('always_field', $always_field); $tem->set('db_fields', $db_fields); + $tem->set('php_fields', $php_fields); return $tem->run(); } diff --git a/metaform/template.html b/metaform/template.html index 8445292..d334cd6 100644 --- a/metaform/template.html +++ b/metaform/template.html @@ -12,9 +12,11 @@ td.caption { text-align: right; font-weight: bold; }

~form_name~ entry form

-
+ - + + +
~caption.html~:
~caption.html~: ~caption.html~:
~caption.html~: ~caption.html~: ~caption.html~: ~caption.html~:
diff --git a/metaform/template.php b/metaform/template.php index 8cbc9e9..2ee09ee 100644 --- a/metaform/template.php +++ b/metaform/template.php @@ -9,51 +9,60 @@ if(!file_exists('code/wfpl/template.php')) { die('This form requires -- 1.7.10.4