You should use a message widget that is embedded within a css style that
highlights the message if it contains anything. When you want to add a
message use:

form.getWidget("message").addMessage("My Message");

Define the widget in the form model:

<fd:messages id="message">
        <fd:datatype base="string"/>
</fd:messages>

In your template:
<div id="message" class="messageSection">
        <div class="messageSectionStyle"><ft:widget id="message"/></div>
</div>

In your style sheet (or you can include it in the page)

.messageSection {
        background-color: #E1E0D7;
        border: 2px inset #C9C9C9;
}

.messageSectionStyle {
        font-family: "Times New Roman", Times, serif;
        font-size: 10pt;
        font-style: italic;
        font-weight: bold;
        color: #336699;
}

-----Original Message-----
From: Bruno Dumon [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 27, 2004 9:46 AM
To: [EMAIL PROTECTED]
Subject: Re: Cocoon FlowScript + woody : change styling via javascript

On Tue, 2004-04-27 at 18:11, [EMAIL PROTECTED] wrote:
> Dear Bruno,
> 
> Thanks for the info
> 
> In fact I'm looking for a solution to display a hidden field  when
> some conditions are met.

ah, I see.

> 
> By example, in my flowscript , I check some value then I discover an
> error.
> At this moment I will change the widget "message" and return the form
> to the user with his data.
> But the messagebox must appear only if the validation is ok.

I see two solutions (for now):

* can't the styling for the "message" widget work so that it doesn't
display anything when there's no message?

* or else, set "somewhere" a flag to indicate the message widget should
be shown, and then use jx:if/jx:choose in the template to check the
value of the flag. As for that "somewhere", this could be:
        - an attribute on the form (see Form.setAttribute)
        - something passed as viewData to the pipeline
        - or again easiest, just check the value of the widget itself,
        only display if it has a value
        
BTW, what is the type of your "message" widget?

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
[EMAIL PROTECTED]                          [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to