You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by John Lasher <jo...@gmail.com> on 2009/04/03 00:22:28 UTC

Inserting dynamic text

I have this following piece of snippet from my html page. I want to be able
to set some dynamic content from my java class within the script tag.
I have searched around quite a bit to find a simple way to do this with
wicket, but can't find anything. Can someone here  please  help? I would
like to keep all the html markup and the script stuff within my html page.
Just want to substitute a single value within the script tag.


<div>
  <labe>Enter Value</label>
  <input id="search_box" name="search_box"  />
  <script type="text/javascript">
       $('search_box').value = *<<dynamic content here>>*
  </script>
</div>

Re: Inserting dynamic text

Posted by Igor Vaynberg <ig...@gmail.com>.
because the value may come from some place accessible only via
javascript? no clue.

-igor

On Thu, Apr 2, 2009 at 3:41 PM, Jeremy Thomerson
<je...@wickettraining.com> wrote:
> Oh - didn't notice that it was inline.
>
> But that begs the question - why do this as JS at all?  Why not just set the
> model of the input field?
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>
>
>
> On Thu, Apr 2, 2009 at 5:36 PM, Igor Vaynberg <ig...@gmail.com>wrote:
>
>> you can let your component implement iheadercontributor rather then
>> bothering with a behavior...but this will go into head - not what he
>> wanted i guess.
>>
>> -igor
>>
>> On Thu, Apr 2, 2009 at 3:34 PM, Jeremy Thomerson
>> <je...@wickettraining.com> wrote:
>> >  Here's one way:
>> >
>> >  add an abstractbehavior to the page that overrides the renderHead
>> method:
>> >
>> >        add(new AbstractBehavior() {
>> >            @Override
>> >            public void renderHead(IHeaderResponse response)
>> >            {
>> >                response.renderJavascript(javascript, id);
>> >            }
>> >        });
>> >
>> >
>> > --
>> > Jeremy Thomerson
>> > http://www.wickettraining.com
>> >
>> >
>> >
>> > On Thu, Apr 2, 2009 at 5:22 PM, John Lasher <john.lasher123@gmail.com
>> >wrote:
>> >
>> >> I have this following piece of snippet from my html page. I want to be
>> able
>> >> to set some dynamic content from my java class within the script tag.
>> >> I have searched around quite a bit to find a simple way to do this with
>> >> wicket, but can't find anything. Can someone here  please  help? I would
>> >> like to keep all the html markup and the script stuff within my html
>> page.
>> >> Just want to substitute a single value within the script tag.
>> >>
>> >>
>> >> <div>
>> >>  <labe>Enter Value</label>
>> >>  <input id="search_box" name="search_box"  />
>> >>  <script type="text/javascript">
>> >>       $('search_box').value = *<<dynamic content here>>*
>> >>  </script>
>> >> </div>
>> >>
>> >
>>
>> ---------------------------------------------------------------------
>> 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: Inserting dynamic text

Posted by James Carman <jc...@carmanconsulting.com>.
On Thu, Apr 2, 2009 at 9:16 PM, John Lasher <jo...@gmail.com> wrote:
> Thanks. I was just too caught up trying to port an exisiting page written
> the way it was that I missed the obvious of not just setting the value on
> the input field.

Not on the input field, but the input field's model.

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


Re: Inserting dynamic text

Posted by John Lasher <jo...@gmail.com>.
Thanks. I was just too caught up trying to port an exisiting page written
the way it was that I missed the obvious of not just setting the value on
the input field.


On Thu, Apr 2, 2009 at 6:41 PM, Jeremy Thomerson
<je...@wickettraining.com>wrote:

> Oh - didn't notice that it was inline.
>
> But that begs the question - why do this as JS at all?  Why not just set
> the
> model of the input field?
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>
>
>
> On Thu, Apr 2, 2009 at 5:36 PM, Igor Vaynberg <igor.vaynberg@gmail.com
> >wrote:
>
> > you can let your component implement iheadercontributor rather then
> > bothering with a behavior...but this will go into head - not what he
> > wanted i guess.
> >
> > -igor
> >
> > On Thu, Apr 2, 2009 at 3:34 PM, Jeremy Thomerson
> > <je...@wickettraining.com> wrote:
> > >  Here's one way:
> > >
> > >  add an abstractbehavior to the page that overrides the renderHead
> > method:
> > >
> > >        add(new AbstractBehavior() {
> > >            @Override
> > >            public void renderHead(IHeaderResponse response)
> > >            {
> > >                response.renderJavascript(javascript, id);
> > >            }
> > >        });
> > >
> > >
> > > --
> > > Jeremy Thomerson
> > > http://www.wickettraining.com
> > >
> > >
> > >
> > > On Thu, Apr 2, 2009 at 5:22 PM, John Lasher <john.lasher123@gmail.com
> > >wrote:
> > >
> > >> I have this following piece of snippet from my html page. I want to be
> > able
> > >> to set some dynamic content from my java class within the script tag.
> > >> I have searched around quite a bit to find a simple way to do this
> with
> > >> wicket, but can't find anything. Can someone here  please  help? I
> would
> > >> like to keep all the html markup and the script stuff within my html
> > page.
> > >> Just want to substitute a single value within the script tag.
> > >>
> > >>
> > >> <div>
> > >>  <labe>Enter Value</label>
> > >>  <input id="search_box" name="search_box"  />
> > >>  <script type="text/javascript">
> > >>       $('search_box').value = *<<dynamic content here>>*
> > >>  </script>
> > >> </div>
> > >>
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>

Re: Inserting dynamic text

Posted by Jeremy Thomerson <je...@wickettraining.com>.
Oh - didn't notice that it was inline.

But that begs the question - why do this as JS at all?  Why not just set the
model of the input field?

--
Jeremy Thomerson
http://www.wickettraining.com



On Thu, Apr 2, 2009 at 5:36 PM, Igor Vaynberg <ig...@gmail.com>wrote:

> you can let your component implement iheadercontributor rather then
> bothering with a behavior...but this will go into head - not what he
> wanted i guess.
>
> -igor
>
> On Thu, Apr 2, 2009 at 3:34 PM, Jeremy Thomerson
> <je...@wickettraining.com> wrote:
> >  Here's one way:
> >
> >  add an abstractbehavior to the page that overrides the renderHead
> method:
> >
> >        add(new AbstractBehavior() {
> >            @Override
> >            public void renderHead(IHeaderResponse response)
> >            {
> >                response.renderJavascript(javascript, id);
> >            }
> >        });
> >
> >
> > --
> > Jeremy Thomerson
> > http://www.wickettraining.com
> >
> >
> >
> > On Thu, Apr 2, 2009 at 5:22 PM, John Lasher <john.lasher123@gmail.com
> >wrote:
> >
> >> I have this following piece of snippet from my html page. I want to be
> able
> >> to set some dynamic content from my java class within the script tag.
> >> I have searched around quite a bit to find a simple way to do this with
> >> wicket, but can't find anything. Can someone here  please  help? I would
> >> like to keep all the html markup and the script stuff within my html
> page.
> >> Just want to substitute a single value within the script tag.
> >>
> >>
> >> <div>
> >>  <labe>Enter Value</label>
> >>  <input id="search_box" name="search_box"  />
> >>  <script type="text/javascript">
> >>       $('search_box').value = *<<dynamic content here>>*
> >>  </script>
> >> </div>
> >>
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Inserting dynamic text

Posted by Igor Vaynberg <ig...@gmail.com>.
you can let your component implement iheadercontributor rather then
bothering with a behavior...but this will go into head - not what he
wanted i guess.

-igor

On Thu, Apr 2, 2009 at 3:34 PM, Jeremy Thomerson
<je...@wickettraining.com> wrote:
>  Here's one way:
>
>  add an abstractbehavior to the page that overrides the renderHead method:
>
>        add(new AbstractBehavior() {
>            @Override
>            public void renderHead(IHeaderResponse response)
>            {
>                response.renderJavascript(javascript, id);
>            }
>        });
>
>
> --
> Jeremy Thomerson
> http://www.wickettraining.com
>
>
>
> On Thu, Apr 2, 2009 at 5:22 PM, John Lasher <jo...@gmail.com>wrote:
>
>> I have this following piece of snippet from my html page. I want to be able
>> to set some dynamic content from my java class within the script tag.
>> I have searched around quite a bit to find a simple way to do this with
>> wicket, but can't find anything. Can someone here  please  help? I would
>> like to keep all the html markup and the script stuff within my html page.
>> Just want to substitute a single value within the script tag.
>>
>>
>> <div>
>>  <labe>Enter Value</label>
>>  <input id="search_box" name="search_box"  />
>>  <script type="text/javascript">
>>       $('search_box').value = *<<dynamic content here>>*
>>  </script>
>> </div>
>>
>

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


Re: Inserting dynamic text

Posted by Jeremy Thomerson <je...@wickettraining.com>.
 Here's one way:

 add an abstractbehavior to the page that overrides the renderHead method:

        add(new AbstractBehavior() {
            @Override
            public void renderHead(IHeaderResponse response)
            {
                response.renderJavascript(javascript, id);
            }
        });


--
Jeremy Thomerson
http://www.wickettraining.com



On Thu, Apr 2, 2009 at 5:22 PM, John Lasher <jo...@gmail.com>wrote:

> I have this following piece of snippet from my html page. I want to be able
> to set some dynamic content from my java class within the script tag.
> I have searched around quite a bit to find a simple way to do this with
> wicket, but can't find anything. Can someone here  please  help? I would
> like to keep all the html markup and the script stuff within my html page.
> Just want to substitute a single value within the script tag.
>
>
> <div>
>  <labe>Enter Value</label>
>  <input id="search_box" name="search_box"  />
>  <script type="text/javascript">
>       $('search_box').value = *<<dynamic content here>>*
>  </script>
> </div>
>

Re: Inserting dynamic text

Posted by Igor Vaynberg <ig...@gmail.com>.
simply use a label.

-igor

On Thu, Apr 2, 2009 at 3:22 PM, John Lasher <jo...@gmail.com> wrote:
> I have this following piece of snippet from my html page. I want to be able
> to set some dynamic content from my java class within the script tag.
> I have searched around quite a bit to find a simple way to do this with
> wicket, but can't find anything. Can someone here  please  help? I would
> like to keep all the html markup and the script stuff within my html page.
> Just want to substitute a single value within the script tag.
>
>
> <div>
>  <labe>Enter Value</label>
>  <input id="search_box" name="search_box"  />
>  <script type="text/javascript">
>       $('search_box').value = *<<dynamic content here>>*
>  </script>
> </div>
>

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