You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by beya! <an...@jibeya.com> on 2004/11/15 01:20:36 UTC
Cform widget not being displayed
Hi,
I am having problems with a widget which is not rendering a text box to
the browser.
In my login.js file I have:
function login() {
var form = new Form("forms/definition.xml");
while (true) {
//Check form integrity
form.showForm("unprotected.xml", {"msg":msg,
"userGlobal":userGlobal});
var model = form.getModel();
//Check user exists
try {
userGlobal = newUser.getUser(model.username,model.password);
break;
}catch(e) {
msg = "Incorrect username or password. Please re-enter.";
}
}
............
In my login.jx file I have specified the following:
<page
xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
xmlns:cinclude="http://apache.org/cocoon/include/1.0"
xmlns:ft="http://apache.org/cocoon/forms/1.0#template"
xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"
>
<login_fields>
<jx:choose>
<jx:when test="${userGlobal==null}">
<ft:form-template name="Form1" id="Form1" method="post"
action="${cocoon.continuation.id}.kont">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="55" valign="bottom"><img src="images/user.gif"
width="55" height="16" /></td>
<td width="100" valign="top">
<ft:widget id="username">
<fi:styling size="30" class="keyinbox"/>
</ft:widget>
</td>
In my definition.xml file I have specified the following:
<?xml version="1.0"?>
<fd:form
xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
<fd:widgets>
<fd:field id="username" required="true">
<fd:label>Username:</fd:label>
<fd:datatype base="string"/>
<fd:validation>
<fd:length min="2"/>
</fd:validation>
</fd:field>
<fd:field id="email" required="true">
<fd:label>Email address:</fd:label>
<fd:datatype base="string"/>
<fd:validation>
<fd:email/>
</fd:validation>
</fd:field>
<fd:field id="password" required="true">
<fd:label>Password:</fd:label>
<fd:datatype base="string"/>
<fd:validation>
<fd:length min="5" max="20"/>
</fd:validation>
</fd:field>
</fd:widgets>
</fd:form>
When the page is rendered as html the widget label name appears but not
the textbox element. What am I doing wrong here?
regards
Andrew
Re: Cform widget not being displayed
Posted by beya! <an...@jibeya.com>.
Ok..
the documentation is misleading! The attribute name should be
listbox-size and not size:
<ft:widget id="username">
<fi:styling listbox-size="30" class="keyinbox"/>
</ft:widget>
All other questions have been answered by amending the
forms-field-styling.xsl file.
regards
Andrew
On 15 Nov 2004, at 11:37, beya! wrote:
> Roberto,
> what I am saying is that the inputbox size I set to 30 is only being
> set to 5 when you view the html. What I should get is:
>
> <input ....size="30">
>
> instead I get
>
> <input .....size="5">
>
> My widget is declared as:
>
> <fd:field id="username" required="true">
> <fd:label>Username</fd:label>
> <fd:datatype base="string"/>
> <fd:validation>
> <fd:length min="2" max="30"/>
> </fd:validation>
> </fd:field>
>
> In my form:
>
> <ft:widget id="username">
> <fi:styling size="30" class="keyinbox"/>
> </ft:widget>
>
> Also, shouldn't the input box end with /> to be xhtml compliant ????
>
>
> regards
>
>
> Andrew
> On 15 Nov 2004, at 11:17, Roberto wrote:
>
>> Andrew,
>> I don't know if I clearly understood your problem. I try to answer to
>> the question nr 1.
>> What I understood in CForms is that you need 2 files, one for
>> definition & one as a template so for istance I use a defLogin.xml
>> file for the definition
>>
>> <?xml version="1.0" encoding="ISO-8859-1"?>
>>
>> <fd:form xmlns:fd="http://apache.org/cocoon/forms/1.0#definition">
>> <fd:widgets>
>>
>> <fd:field id="txtNome" required="true">
>> <fd:label>Nome:</fd:label>
>> <fd:datatype base="string"/>
>> <fd:validation>
>> <fd:length min="2"/>
>> </fd:validation>
>> </fd:field>
>>
>> <fd:field id="txtPassword" required="true">
>> <fd:label>Password:</fd:label>
>> <fd:datatype base="string"/>
>> <fd:validation>
>> <fd:length min="5" max="20"/>
>> </fd:validation>
>> </fd:field>
>>
>> </fd:widgets>
>> </fd:form>
>> And the template ... (just a snippet)
>>
>> <p class="label"><ft:widget-label id="txtNome" /></p>
>> <ft:widget id="txtNome">
>> <fi:styling class="txt"/>
>> </ft:widget>
>>
>> <p class="label"><ft:widget-label id="txtPassword"/></p>
>> <ft:widget id="txtPassword">
>> <fi:styling type="password"/>
>> <fi:styling class="txtPwd"/>
>> </ft:widget>
>>
>> & then I use the .css file to format the output.
>>
>> .txt{
>> font-family:"Verdana", Helvetica, sans-serif;
>> color:#000077;
>> background:#FFCC00;
>> text-align:left;
>> cursor:text;
>> width:170px;
>> border : 1px #aaaaaa solid
>> }
>>
>> In this case I can have the size of the field how long as I want.
>>
>>
>> In your example, you declare a widget with "username" id, but then
>> you refer to an input called "password", so Im a little confused...
>>
>> Since Im a newbie, I don't know about question nr.2 & 3, sorry.
>>
>> Hope that I could help you.
>>
>> Ciao
>> Roberto
>>
>>
>>
>>
>> ----- Original Message -----
>>
>> From: beya!
>> To: users@cocoon.apache.org
>> Sent: Monday, November 15, 2004 11:37 AM
>> Subject: Re: Cform widget not being displayed
>>
>> Roberto,
>> thanks for that information it worked fine. I am experiencing another
>> problem now. I have declared my widget styling as:
>>
>> <ft:widget id="username">
>> <fi:styling size="30" class="keyinbox"/>
>> </ft:widget>
>> So I want the input box to have a size of 30 but the size in the html
>> is 5:
>>
>> <input name="password" id="password" value="" title=""
>> type="password" size="5" class="keyinbox"><span
>> class="forms-field-required"> * </span>
>>
>> 1. How do I make the size of the box 30?
>>
> <beya-email.gif>
> +The home of urban music
> + http://www.beyarecords.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
Re: Cform widget not being displayed
Posted by beya! <an...@jibeya.com>.
Roberto,
what I am saying is that the inputbox size I set to 30 is only being
set to 5 when you view the html. What I should get is:
<input ....size="30">
instead I get
<input .....size="5">
My widget is declared as:
<fd:field id="username" required="true">
<fd:label>Username</fd:label>
<fd:datatype base="string"/>
<fd:validation>
<fd:length min="2" max="30"/>
</fd:validation>
</fd:field>
In my form:
<ft:widget id="username">
<fi:styling size="30" class="keyinbox"/>
</ft:widget>
Also, shouldn't the input box end with /> to be xhtml compliant ????
regards
Andrew
On 15 Nov 2004, at 11:17, Roberto wrote:
> Andrew,
> I don't know if I clearly understood your problem. I try to answer to
> the question nr 1.
> What I understood in CForms is that you need 2 files, one for
> definition & one as a template so for istance I use a defLogin.xml
> file for the definition
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
>
> <fd:form xmlns:fd="http://apache.org/cocoon/forms/1.0#definition">
> <fd:widgets>
>
> <fd:field id="txtNome" required="true">
> <fd:label>Nome:</fd:label>
> <fd:datatype base="string"/>
> <fd:validation>
> <fd:length min="2"/>
> </fd:validation>
> </fd:field>
>
> <fd:field id="txtPassword" required="true">
> <fd:label>Password:</fd:label>
> <fd:datatype base="string"/>
> <fd:validation>
> <fd:length min="5" max="20"/>
> </fd:validation>
> </fd:field>
>
> </fd:widgets>
> </fd:form>
> And the template ... (just a snippet)
>
> <p class="label"><ft:widget-label id="txtNome" /></p>
> <ft:widget id="txtNome">
> <fi:styling class="txt"/>
> </ft:widget>
>
> <p class="label"><ft:widget-label id="txtPassword"/></p>
> <ft:widget id="txtPassword">
> <fi:styling type="password"/>
> <fi:styling class="txtPwd"/>
> </ft:widget>
>
> & then I use the .css file to format the output.
>
> .txt{
> font-family:"Verdana", Helvetica, sans-serif;
> color:#000077;
> background:#FFCC00;
> text-align:left;
> cursor:text;
> width:170px;
> border : 1px #aaaaaa solid
> }
>
> In this case I can have the size of the field how long as I want.
>
>
> In your example, you declare a widget with "username" id, but then you
> refer to an input called "password", so Im a little confused...
>
> Since Im a newbie, I don't know about question nr.2 & 3, sorry.
>
> Hope that I could help you.
>
> Ciao
> Roberto
>
>
>
>
> ----- Original Message -----
> From: beya!
> To: users@cocoon.apache.org
> Sent: Monday, November 15, 2004 11:37 AM
> Subject: Re: Cform widget not being displayed
>
> Roberto,
> thanks for that information it worked fine. I am experiencing another
> problem now. I have declared my widget styling as:
>
> <ft:widget id="username">
> <fi:styling size="30" class="keyinbox"/>
> </ft:widget>
> So I want the input box to have a size of 30 but the size in the html
> is 5:
>
> <input name="password" id="password" value="" title="" type="password"
> size="5" class="keyinbox"><span class="forms-field-required"> *
> </span>
>
> 1. How do I make the size of the box 30?
>
Re: Cform widget not being displayed
Posted by Roberto <rm...@montefiore.ch>.
Andrew,
I don't know if I clearly understood your problem. I try to answer to the question nr 1.
What I understood in CForms is that you need 2 files, one for definition & one as a template so for istance I use a defLogin.xml file for the definition
<?xml version="1.0" encoding="ISO-8859-1"?>
<fd:form xmlns:fd="http://apache.org/cocoon/forms/1.0#definition">
<fd:widgets>
<fd:field id="txtNome" required="true">
<fd:label>Nome:</fd:label>
<fd:datatype base="string"/>
<fd:validation>
<fd:length min="2"/>
</fd:validation>
</fd:field>
<fd:field id="txtPassword" required="true">
<fd:label>Password:</fd:label>
<fd:datatype base="string"/>
<fd:validation>
<fd:length min="5" max="20"/>
</fd:validation>
</fd:field>
</fd:widgets>
</fd:form>
And the template ... (just a snippet)
<p class="label"><ft:widget-label id="txtNome" /></p>
<ft:widget id="txtNome">
<fi:styling class="txt"/>
</ft:widget>
<p class="label"><ft:widget-label id="txtPassword"/></p>
<ft:widget id="txtPassword">
<fi:styling type="password"/>
<fi:styling class="txtPwd"/>
</ft:widget>
& then I use the .css file to format the output.
.txt{
font-family:"Verdana", Helvetica, sans-serif;
color:#000077;
background:#FFCC00;
text-align:left;
cursor:text;
width:170px;
border : 1px #aaaaaa solid
}
In this case I can have the size of the field how long as I want.
In your example, you declare a widget with "username" id, but then you refer to an input called "password", so Im a little confused...
Since Im a newbie, I don't know about question nr.2 & 3, sorry.
Hope that I could help you.
Ciao
Roberto
----- Original Message -----
From: beya!
To: users@cocoon.apache.org
Sent: Monday, November 15, 2004 11:37 AM
Subject: Re: Cform widget not being displayed
Roberto,
thanks for that information it worked fine. I am experiencing another problem now. I have declared my widget styling as:
<ft:widget id="username">
<fi:styling size="30" class="keyinbox"/>
</ft:widget>
So I want the input box to have a size of 30 but the size in the html is 5:
<input name="password" id="password" value="" title="" type="password" size="5" class="keyinbox"><span class="forms-field-required"> * </span>
1. How do I make the size of the box 30?
Re: Cform widget not being displayed
Posted by beya! <an...@jibeya.com>.
Roberto,
thanks for that information it worked fine. I am experiencing another
problem now. I have declared my widget styling as:
<ft:widget id="username">
<fi:styling size="30" class="keyinbox"/>
</ft:widget>
So I want the input box to have a size of 30 but the size in the html
is 5:
<input name="password" id="password" value="" title="" type="password"
size="5" class="keyinbox"><span class="forms-field-required"> * </span>
1. How do I make the size of the box 30?
2. How do I keep the field required but not display <span
class="forms-field-required"> * </span> in the html? I have designed my
own images which sit at the end of the input box.
3. In the form declaration line:
<ft:form-template action="${cocoon.continuation.id}.kont" name="Form1"
method="POST">
if I remove the action so i have:
<ft:form-template name="Form1" method="POST">
I get the following error:
cause: java.lang.ArrayIndexOutOfBoundsException: Attempt to modify
attribute at illegal index: -1
full exception chain stacktrace[hide]
Original Exception: java.lang.ArrayIndexOutOfBoundsException: Attempt
to modify attribute at illegal index: -1
at org.xml.sax.helpers.AttributesImpl.badIndex(Unknown Source)
at org.xml.sax.helpers.AttributesImpl.setValue(Unknown Source)
at
org.apache.cocoon.forms.transformation.EffectWidgetReplacingPipe.transla
teAttributes(EffectWidgetReplacingPipe.java:755)
at
org.apache.cocoon.forms.transformation.EffectWidgetReplacingPipe.access$
200(EffectWidgetReplacingPipe.java:63)
at
org.apache.cocoon.forms.transformation.EffectWidgetReplacingPipe$FormHan
dler.process(EffectWidgetReplacingPipe.java:319)
at
org.apache.cocoon.forms.transformation.EffectPipe.startElement(EffectPip
e.java:412)
at
org.apache.cocoon.generation.JXTemplateGenerator.execute(JXTemplateGener
ator.java:3660)
at
org.apache.cocoon.generation.JXTemplateGenerator.execute(JXTemplateGener
ator.java:3445)
at
org.apache.cocoon.generation.JXTemplateGenerator.performGeneration(JXTem
plateGenerator.java:2979)
at
org.apache.cocoon.generation.JXTemplateGenerator.generate(JXTemplateGene
rator.java:2970)
..............
Why is this error being caused. My intention was to have the
continuation id hidden from the url.
regards
Andrew
On 15 Nov 2004, at 07:35, Roberto wrote:
> The widget are not displayed could be because you need to add this to
> your pipeline:
>
> <map:transform type="forms"/>
> <map:transform src="style/xsl/cforms/forms-field-styling.xsl"/>
> try to have a look of this page
> http://cocoon.apache.org/2.1/userdocs/forms/xslt.html maybe can help
> you.
>
> Ciao
> Roberto
>
>
Re: Cform widget not being displayed
Posted by Roberto <rm...@montefiore.ch>.
The widget are not displayed could be because you need to add this to your pipeline:
<map:transform type="forms"/>
<map:transform src="style/xsl/cforms/forms-field-styling.xsl"/>
try to have a look of this page http://cocoon.apache.org/2.1/userdocs/forms/xslt.html maybe can help you.
Ciao
Roberto
Re: Cform widget not being displayed
Posted by beya! <an...@jibeya.com>.
Hi,
further again to my last 2 emails is my sitemap definition:
<map:match pattern="unprotected.xml">
<map:generate type="jx" src="jx/login.jx"/>
<map:transform type="forms"/>
<map:transform type="cinclude"/>
<map:transform type="xsltc" src="style/login.xsl"/>
<map:call resource="serialize"/>
</map:match>
regards
Andrew
On 15 Nov 2004, at 00:25, beya! wrote:
> Hi,
> further to my last email when I checked the html source I get the
> following output where the input box should be:
>
> <field id="username" required="true">
> <datatype type="string"></datatype>
> <styling size="30" class="keyinbox"></styling>
> </field>
>
> Is this correct?
>
> regards
>
>
> Andrew
>
>
>
> On 15 Nov 2004, at 00:20, beya! wrote:
>
>> Hi,
>> I am having problems with a widget which is not rendering a text box
>> to the browser.
>>
>> In my login.js file I have:
>>
>> function login() {
>> var form = new Form("forms/definition.xml");
>>
>> while (true) {
>>
>> //Check form integrity
>> form.showForm("unprotected.xml", {"msg":msg,
>> "userGlobal":userGlobal});
>> var model = form.getModel();
>>
>> //Check user exists
>> try {
>> userGlobal = newUser.getUser(model.username,model.password);
>> break;
>> }catch(e) {
>> msg = "Incorrect username or password. Please re-enter.";
>> }
>> }
>> ............
>>
>> In my login.jx file I have specified the following:
>>
>> <page
>> xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
>> xmlns:cinclude="http://apache.org/cocoon/include/1.0"
>> xmlns:ft="http://apache.org/cocoon/forms/1.0#template"
>> xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"
>> >
>> <login_fields>
>> <jx:choose>
>> <jx:when test="${userGlobal==null}">
>> <ft:form-template name="Form1" id="Form1" method="post"
>> action="${cocoon.continuation.id}.kont">
>> <table width="100%" border="0" cellspacing="0" cellpadding="0">
>> <tr>
>> <td width="55" valign="bottom"><img src="images/user.gif"
>> width="55" height="16" /></td>
>> <td width="100" valign="top">
>> <ft:widget id="username">
>> <fi:styling size="30" class="keyinbox"/>
>> </ft:widget>
>> </td>
>>
>> In my definition.xml file I have specified the following:
>>
>> <?xml version="1.0"?>
>>
>> <fd:form
>> xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
>> xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
>>
>> <fd:widgets>
>> <fd:field id="username" required="true">
>> <fd:label>Username:</fd:label>
>> <fd:datatype base="string"/>
>> <fd:validation>
>> <fd:length min="2"/>
>> </fd:validation>
>> </fd:field>
>>
>> <fd:field id="email" required="true">
>> <fd:label>Email address:</fd:label>
>> <fd:datatype base="string"/>
>> <fd:validation>
>> <fd:email/>
>> </fd:validation>
>> </fd:field>
>>
>> <fd:field id="password" required="true">
>> <fd:label>Password:</fd:label>
>> <fd:datatype base="string"/>
>> <fd:validation>
>> <fd:length min="5" max="20"/>
>> </fd:validation>
>> </fd:field>
>> </fd:widgets>
>>
>> </fd:form>
>>
>>
>> When the page is rendered as html the widget label name appears but
>> not the textbox element. What am I doing wrong here?
>>
>> regards
>>
>>
>> Andrew
>
>
Re: Cform widget not being displayed
Posted by beya! <an...@jibeya.com>.
Hi,
further to my last email when I checked the html source I get the
following output where the input box should be:
<field id="username" required="true">
<datatype type="string"></datatype>
<styling size="30" class="keyinbox"></styling>
</field>
Is this correct?
regards
Andrew
On 15 Nov 2004, at 00:20, beya! wrote:
> Hi,
> I am having problems with a widget which is not rendering a text box
> to the browser.
>
> In my login.js file I have:
>
> function login() {
> var form = new Form("forms/definition.xml");
>
> while (true) {
>
> //Check form integrity
> form.showForm("unprotected.xml", {"msg":msg,
> "userGlobal":userGlobal});
> var model = form.getModel();
>
> //Check user exists
> try {
> userGlobal = newUser.getUser(model.username,model.password);
> break;
> }catch(e) {
> msg = "Incorrect username or password. Please re-enter.";
> }
> }
> ............
>
> In my login.jx file I have specified the following:
>
> <page
> xmlns:jx="http://apache.org/cocoon/templates/jx/1.0"
> xmlns:cinclude="http://apache.org/cocoon/include/1.0"
> xmlns:ft="http://apache.org/cocoon/forms/1.0#template"
> xmlns:fi="http://apache.org/cocoon/forms/1.0#instance"
> >
> <login_fields>
> <jx:choose>
> <jx:when test="${userGlobal==null}">
> <ft:form-template name="Form1" id="Form1" method="post"
> action="${cocoon.continuation.id}.kont">
> <table width="100%" border="0" cellspacing="0" cellpadding="0">
> <tr>
> <td width="55" valign="bottom"><img src="images/user.gif"
> width="55" height="16" /></td>
> <td width="100" valign="top">
> <ft:widget id="username">
> <fi:styling size="30" class="keyinbox"/>
> </ft:widget>
> </td>
>
> In my definition.xml file I have specified the following:
>
> <?xml version="1.0"?>
>
> <fd:form
> xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"
> xmlns:i18n="http://apache.org/cocoon/i18n/2.1">
>
> <fd:widgets>
> <fd:field id="username" required="true">
> <fd:label>Username:</fd:label>
> <fd:datatype base="string"/>
> <fd:validation>
> <fd:length min="2"/>
> </fd:validation>
> </fd:field>
>
> <fd:field id="email" required="true">
> <fd:label>Email address:</fd:label>
> <fd:datatype base="string"/>
> <fd:validation>
> <fd:email/>
> </fd:validation>
> </fd:field>
>
> <fd:field id="password" required="true">
> <fd:label>Password:</fd:label>
> <fd:datatype base="string"/>
> <fd:validation>
> <fd:length min="5" max="20"/>
> </fd:validation>
> </fd:field>
> </fd:widgets>
>
> </fd:form>
>
>
> When the page is rendered as html the widget label name appears but
> not the textbox element. What am I doing wrong here?
>
> regards
>
>
> Andrew