[Checkins] SVN: grok/trunk/doc/ Another sample.
Martijn Faassen
faassen at infrae.com
Sat Mar 17 11:28:46 EDT 2007
Log message for revision 73296:
Another sample.
Changed:
A grok/trunk/doc/groktut/showing_the_value_in_the_form/
U grok/trunk/doc/groktut/showing_the_value_in_the_form/src/sample/app_templates/edit.pt
U grok/trunk/doc/tutorial.txt
-=-
Copied: grok/trunk/doc/groktut/showing_the_value_in_the_form (from rev 73295, grok/trunk/doc/groktut/redirection)
Modified: grok/trunk/doc/groktut/showing_the_value_in_the_form/src/sample/app_templates/edit.pt
===================================================================
--- grok/trunk/doc/groktut/redirection/src/sample/app_templates/edit.pt 2007-03-17 15:22:37 UTC (rev 73295)
+++ grok/trunk/doc/groktut/showing_the_value_in_the_form/src/sample/app_templates/edit.pt 2007-03-17 15:28:46 UTC (rev 73296)
@@ -1,7 +1,7 @@
<html>
<body>
<form tal:attributes="action view/url" method="POST">
-Text to store: <input type="text" name="text" value="" /><br />
+Text to store: <input type="text" name="text" tal:attributes="value python:context.text" value="" /><br />
<input type="submit" value="Store" />
</form>
</body>
Modified: grok/trunk/doc/tutorial.txt
===================================================================
--- grok/trunk/doc/tutorial.txt 2007-03-17 15:22:37 UTC (rev 73295)
+++ grok/trunk/doc/tutorial.txt 2007-03-17 15:28:46 UTC (rev 73296)
@@ -913,30 +913,20 @@
special method available on all ``grok.View`` subclasses,
``redirect``. We tell the system to redirect to the ``index`` page.
-Form value
-----------
+Showing the value in the form
+-----------------------------
-Let's change our application so it displays what we last entered in
-the edit form as well, not just in on the index page.
+Let's change our application so it displays what we stored the edit
+form as well, not just on the index page.
-To make this work, change edit.pt so it reads like this::
+To make this work, change edit.pt so it reads like this:
- <html>
- <body>
- <form tal:attributes="action view/url" method="POST">
- Text to store: <input type="text" name="text" tal:attributes="value python:context.text" value="" /><br />
- <input type="submit" value="Store" />
- </form>
- </body>
- </html>
+.. include:: groktut/showing_the_value_in_the_form/src/sample/app_templates/edit.pt
+ :literal:
The only change is that we have used ``tal:attributes`` to include the
value of the ``text`` attribute of the context object in the form.
-While we explain here on how to do this manually here, there is also
-an automatic way to do this, with many more features. For much more on
-this, see section XXX on EditForms.
-
The rules of persistence
------------------------
More information about the Checkins
mailing list