You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Philipp Bößem <ph...@boessem.de> on 2002/06/07 15:31:56 UTC
EDITING UPDATING DATA FROM AN SQL-DATABASE
+------------------------------------------------+
$ I NEED HELP !!!
$ EDITING UPDATING DATA FROM AN SQL-DATABASE
$ WITH XSP
+------------------------------------------------+
right then.
- what i tried:
i tried, to recreate the tutorial example in cocoon2 (creating, updating,
and editing data in my database)
that for i made a copy of the tutorial and created a new subsitemap with a
slightly different name, and another database connection, but in the first
step using a copy of identicall tables.
the tutorial works perfect!
- problem is:
the recreated emxample runs until the point, where i wanna pick up value
from the database, to edit it. deletion and creating works.
when i want to change the data in editing-department, by typing in a new
name, and pressing update department, the same value like bevor is
displayed.
i asked someone, if it could be a problem related to the format of my table.
but because of the fact, that its an identicall copy of the tutorial table
that guy meant, that this would be unlikely.
i had an closer look to the generated html source file of the edit
department.
there was a slightly different source entrie with in the code of the
displayed html source:
instead of showing:
<input value="1" name="id" type="hidden">
Name: <span style="color: #ff0000;">*</span><input value="Informatik"
size="30" name="name" type="text">
the source of the recreated edit-department looks like:
<input value=" 1 " name="id" type="hidden">
Name: <span style="color: #ff0000;">*</span><input value=" Informatik "
size="30" name="name" type="text">
when i realised that, i had an closer look to, if i have got any spaces
within my queries, or values. but obviously i dont.
i also deleted the work directory a couple of times, but the original
tutorial worked, but the other didnt.
iff anyone has got an idea, why this happens i would be very cratefull, to
get an reply!!
my files by the look like this:
edit-dept.xsp:
<?xml version="1.0"?>
<xsp:page xmlns:xsp="http://apache.org/xsp"
xmlns:xsp-formval="http://apache.org/xsp/form-validator/2.0"
xmlns:xsp-request="http://apache.org/xsp/request/2.0"
xmlns:esql="http://apache.org/cocoon/SQL/v2">
<document>
<header>
<title>Department</title>
</header>
<body>
<s1 title="Create a Department">
<form handler="edit-dept.html">
<p>
You can create a department by typing in the
name and pressing the "submit" button.
</p>
<p>
<parameter name="id">
<xsp:attribute name="value">
<xsp-request:get-parameter name="id"/>
</xsp:attribute>
</parameter>
<esql:connection>
<esql:pool>personnel</esql:pool>
<esql:execute-query>
<esql:query>
SELECT name FROM department
WHERE id = <esql:parameter>
<xsp-request:get-parameter name="id"/>
</esql:parameter>
</esql:query>
<esql:results>
<esql:row-results>
Name: <text name="name" size="30" required="true">
<xsp:attribute name="value">
<esql:get-string column="name"/>
</xsp:attribute>
</text>
<br/>
<xsp-formval:on-toosmall name="name">
Name must be at least 5 characters.
</xsp-formval:on-toosmall>
<xsp-formval:on-toolarge name="name">
Name must be less than 64 characters.
</xsp-formval:on-toolarge>
</esql:row-results>
</esql:results>
</esql:execute-query>
</esql:connection>
</p>
<submit name="Update Department"/>
<submit name="Delete Department"/>
<note>
* These fields are required.
</note>
</form>
</s1>
</body>
</document>
</xsp:page>
---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
To unsubscribe, e-mail: <co...@xml.apache.org>
For additional commands, e-mail: <co...@xml.apache.org>