You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Brill Pappin <br...@pappin.ca> on 2007/10/29 04:06:47 UTC

conditionally including a div

I'm porting an app written in Ruby on Rails as a spike on how Wicket works.
I've run into an issue I'm not sure how to handle.
 
I have the case of a message box near the top of the screen that's in a
conditional block... here is the ruby code to demonstrate:
<% if @flash[:notice] %>
	<div id="flash_notice_wrapper"><%= @flash[:notice] %></div>
<% end %>

(fyi, flash in this context is not Flash, but a "flash message")

I get the part of wicket were I can attach a component to the div element,
but what I really want is the div to not be there if it's not needed.
Is there any way to actually remove the div if I don't need it in the
content?
Is there a "non-html" wicket tag I haven't found yet for adding a
placeholder instead of the div?

- Brill Pappin


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: conditionally including a div

Posted by Eelco Hillenius <ee...@gmail.com>.
On 10/28/07, Brill Pappin <br...@pappin.ca> wrote:
> I'm porting an app written in Ruby on Rails as a spike on how Wicket works.
> I've run into an issue I'm not sure how to handle.
>
> I have the case of a message box near the top of the screen that's in a
> conditional block... here is the ruby code to demonstrate:
> <% if @flash[:notice] %>
>         <div id="flash_notice_wrapper"><%= @flash[:notice] %></div>
> <% end %>
>
> (fyi, flash in this context is not Flash, but a "flash message")
>
> I get the part of wicket were I can attach a component to the div element,
> but what I really want is the div to not be there if it's not needed.
> Is there any way to actually remove the div if I don't need it in the
> content?
> Is there a "non-html" wicket tag I haven't found yet for adding a
> placeholder instead of the div?

You attach that component to the div element and you do
setVisible(false) or override isVisible to let it return false when
you don't want to the div. Additionally, if you have markup around a
component you like to hide with the component, you can use
<wicket:enclosure>

Eelco

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: conditionally including a div

Posted by Igor Vaynberg <ig...@gmail.com>.
for flash messages you actually need to do getsession().info("foo") so
it lasts across requests :)

-igor


On 10/29/07, Martijn Dashorst <ma...@gmail.com> wrote:
> flash messages:
>
> info("foo");
>
> add(new FeedbackPanel("feedbackpanel"));
>
> <div wicket:id="feedbackpanel"></div>
>
> Martijn
>
>
> On 10/29/07, Brill Pappin <br...@pappin.ca> wrote:
> > I'm porting an app written in Ruby on Rails as a spike on how Wicket works.
> > I've run into an issue I'm not sure how to handle.
> >
> > I have the case of a message box near the top of the screen that's in a
> > conditional block... here is the ruby code to demonstrate:
> > <% if @flash[:notice] %>
> >         <div id="flash_notice_wrapper"><%= @flash[:notice] %></div>
> > <% end %>
> >
> > (fyi, flash in this context is not Flash, but a "flash message")
> >
> > I get the part of wicket were I can attach a component to the div element,
> > but what I really want is the div to not be there if it's not needed.
> > Is there any way to actually remove the div if I don't need it in the
> > content?
> > Is there a "non-html" wicket tag I haven't found yet for adding a
> > placeholder instead of the div?
> >
> > - Brill Pappin
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
>
> --
> Buy Wicket in Action: http://manning.com/dashorst
> Apache Wicket 1.3.0-beta4 is released
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta4/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: conditionally including a div

Posted by Martijn Dashorst <ma...@gmail.com>.
flash messages:

info("foo");

add(new FeedbackPanel("feedbackpanel"));

<div wicket:id="feedbackpanel"></div>

Martijn


On 10/29/07, Brill Pappin <br...@pappin.ca> wrote:
> I'm porting an app written in Ruby on Rails as a spike on how Wicket works.
> I've run into an issue I'm not sure how to handle.
>
> I have the case of a message box near the top of the screen that's in a
> conditional block... here is the ruby code to demonstrate:
> <% if @flash[:notice] %>
>         <div id="flash_notice_wrapper"><%= @flash[:notice] %></div>
> <% end %>
>
> (fyi, flash in this context is not Flash, but a "flash message")
>
> I get the part of wicket were I can attach a component to the div element,
> but what I really want is the div to not be there if it's not needed.
> Is there any way to actually remove the div if I don't need it in the
> content?
> Is there a "non-html" wicket tag I haven't found yet for adding a
> placeholder instead of the div?
>
> - Brill Pappin
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.0-beta4 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta4/

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org