Skip to content

Instantly share code, notes, and snippets.

@sminnee
Created November 5, 2009 01:50
Show Gist options
  • Select an option

  • Save sminnee/226616 to your computer and use it in GitHub Desktop.

Select an option

Save sminnee/226616 to your computer and use it in GitHub Desktop.
Index: sapphire/forms/FieldSet.php
===================================================================
--- sapphire/forms/FieldSet.php (revision 90572)
+++ sapphire/forms/FieldSet.php (working copy)
@@ -418,7 +418,7 @@
* @return FieldSet
*/
function HiddenFields() {
- $hiddenFields = new FieldSet();
+ $hiddenFields = new HiddenFieldSet();
$dataFields = $this->dataFields();
if($dataFields) foreach($dataFields as $field) {
@@ -534,4 +534,18 @@
}
+/**
+ * A fieldset designed to store a list of hidden fields. When inserted into a template, only the
+ * input tags will be included
+ */
+class HiddenFieldSet extends FieldSet {
+ function forTemplate() {
+ $output = "";
+ foreach($this as $field) {
+ $output .= $field->Field();
+ }
+ return $output;
+ }
+}
+
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment