You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rivet-dev@tcl.apache.org by ka...@apache.org on 2009/09/17 18:13:31 UTC
svn commit: r816256 - in /tcl/rivet/trunk: ChangeLog form.txt
rivet/packages/form/form.tcl
Author: karl
Date: Thu Sep 17 16:13:30 2009
New Revision: 816256
URL: http://svn.apache.org/viewvc?rev=816256&view=rev
Log:
* rivet/packages/form/form.tcl, form.txt: Add a new form method, "button",
that's just like "submit" except pressing enter doesn't cause it to be
invoked. Add quick doc, form.txt, on the forms package.
Terminate <option> with </option> in form selectors.
Added:
tcl/rivet/trunk/form.txt
Modified:
tcl/rivet/trunk/ChangeLog
tcl/rivet/trunk/rivet/packages/form/form.tcl
Modified: tcl/rivet/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/ChangeLog?rev=816256&r1=816255&r2=816256&view=diff
==============================================================================
--- tcl/rivet/trunk/ChangeLog (original)
+++ tcl/rivet/trunk/ChangeLog Thu Sep 17 16:13:30 2009
@@ -1,3 +1,10 @@
+2009-09-17 Karl Lehenbauer <ka...@apache.org>
+ * rivet/packages/form/form.tcl, form.txt: Add a new form method, "button",
+ that's just like "submit" except pressing enter doesn't cause it to be
+ invoked. Add quick doc, form.txt, on the forms package.
+
+ Terminate <option> with </option> in form selectors.
+
2009-09-15 Karl Lehenbauer <ka...@apache.org>
* rivet/packages/form/form.tcl: If the array containing default values
for the form is passed in when the form is created
Added: tcl/rivet/trunk/form.txt
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/form.txt?rev=816256&view=auto
==============================================================================
--- tcl/rivet/trunk/form.txt (added)
+++ tcl/rivet/trunk/form.txt Thu Sep 17 16:13:30 2009
@@ -0,0 +1,163 @@
+Super quick doc on the Rivet form package.
+
+Forms directly emit HTML so if you want to format them in a table or
+something, you've got to be emitting your table around your form calls.
+See the example.
+
+The supported field types are:
+
+ checkbox
+
+ text
+
+ password
+
+ hidden
+
+ submit
+
+ button
+
+ reset
+
+ image
+
+ radiobuttons
+
+ select
+
+ textarea
+
+
+
+
+form myform -defaults tag -method post -action view_photo.rvt
+
+ This defines a form called "myform", says that default values can be
+ taken from an array named "tag", specifies that the submit method
+ will be "post" and that the view_photo.rvt URL will be invoked
+ upon submission.
+
+myform start
+
+ This starts emitting the form. It will generate the "<form>" HTML.
+
+myform text tail -size 8 -maxlength 20
+
+ This defines a single line text entry box.
+
+myform textarea description -cols 60 -rows 8
+
+ This defines a multiline text box.
+
+
+myform select part_of_day -labels [list "" Day Dawn Dusk Night] -values [list "" day dawn dusk night] -style "width: 160px;"
+
+ This defines a dropbox. The labels of each entry will be blank,
+ Day, Dawn, Dusk, Night, and the values sent in the field named
+ "part_of_day" will correspondingly be blank, day, dawn, dusk and
+ night.
+
+ If values is not set, the labels will be used.
+
+
+myform radiobuttons station -labels [list "" KUHF KLOL KRBE KLBJ] -values [list "" kuhg klol krbe klbj]
+
+ If values is not set, the labels will be used.
+
+myform hidden upload_id -value $uploadID
+
+ This specifies a hidden field named upload_id and assigns a value to
+ it as the contents of the variable uploadID.
+
+
+myform submit Tag
+
+ This creates the submit button for the form and calls it Tag.
+
+myform button Tag
+
+ This creates a clickable button for the form and calls it Tag. Unlike
+ a submit element, button elements are not invoked if the user presses
+ "Enter".
+
+myform cancel
+
+ This create the cancel button for the form.
+
+myform end
+
+ This ends the form and is mandatory. It generates the HTML to
+ complete the form.
+
+
+myform destroy
+
+ This gets rid of the form object.
+
+FILE UPLOADING
+
+There isn't a form type in forms at this time for uploading a file, however
+you can do it by emitting something like:
+
+ <input type="file" name="media" size="40">
+
+
+
+EXAMPLE
+
+package require form
+
+form myform -defaults response -method get -name feedsearch
+
+ myform start
+
+puts "<table>"
+puts "<tr>"
+
+puts "<td>"
+ myform select codebase -values [list stable beta] -labels [list Stable Beta]
+puts "</td>"
+
+puts "<td>"
+ myform select type -values [list xmlparsed parsed] -labels [list XML T1]
+puts "</td>"
+
+puts "<td>ident</td><td>"
+myform text ident -size 8
+puts "</td>"
+
+puts "<td>"
+myform select startMonth -values "1 2 3 4 5 6 7 8 9 10 11 12"
+puts "</td>"
+
+puts "<td>"
+myform select startDay -values "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
+20 21 22 23 24 25 26 27 28 29 30 31"
+puts "</td>"
+
+puts "<td>"
+myform select startYear -values "2005 2006 2007 2008"
+puts "</td>"
+
+puts "<td>days</td>"
+
+puts "<td>"
+myform select days -values "1 2 3"
+puts "</td>"
+
+puts "<td>"
+myform submit submit -value Search
+puts "</td>"
+
+puts "</tr>"
+puts "</table>"
+
+emit_toggle_all_function
+emit_toggle_buttons
+
+
+ myform end
+
+ myform destroy
+
Modified: tcl/rivet/trunk/rivet/packages/form/form.tcl
URL: http://svn.apache.org/viewvc/tcl/rivet/trunk/rivet/packages/form/form.tcl?rev=816256&r1=816255&r2=816256&view=diff
==============================================================================
--- tcl/rivet/trunk/rivet/packages/form/form.tcl (original)
+++ tcl/rivet/trunk/rivet/packages/form/form.tcl Thu Sep 17 16:13:30 2009
@@ -259,6 +259,13 @@
}
#
+ # button -- emit an HTML "button" field
+ #
+ method button {name args} {
+ eval field button $name $args
+ }
+
+ #
# reset -- emit an HTML "reset" button
#
method reset {name args} {
@@ -358,7 +365,7 @@
} else {
set string "<option value=\"$value\">"
}
- html $string$label
+ html "$string$label</option>"
}
html "</select>"
}
---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-cvs-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-cvs-help@tcl.apache.org