You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "X. Y. Zhao" <x....@gmail.com> on 2005/08/11 21:12:43 UTC
Client-side updating input fields
Hello again.
I would like to know how it is possible (tap 4) to have client-side
javascript update the value of a hidden input form, which in turn is
submitted to the server and it's value is read by a tapestry form
listener.
For example:
Template.html:
<form jwcid="@Form" listener="listener:doSubmit"
onSubmit="updateField()">
<input jwcid="@Hidden" value="ognl:value" id="FIELD"/>
<input jwcid="@Submit"/>
</form>
<script language="javascript">
function updateField() {
document.getElementById("FIELD").value = "test";
}
</script>
Template.java:
public abstract String getValue();
...
public void doSubmit() {
log.debug(getValue().equals("test")); // <-- can i accomplish
this?
}
Thanks for any help.
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Client-side updating input fields
Posted by "X. Y. Zhao" <x....@gmail.com>.
I know it is possible to do this, as DatePicker, and Palette from the
contrib library do similar things. Anyone have more specific clues?
On 11-Aug-05, at 160500, Rhys Causey wrote:
> Hi,
>
> Thanks for your response.
>
> From what I've read, it seems like this is a good way to access
> Tapestry-created elements, but is it possible to actually change
> their values? I would have to set the value of the hidden field on
> the client side.
>
> Thanks.
>
> On 11-Aug-05, at 3:33 PM, Mark Dillon wrote:
>
>
>> I do this with the @Script component. Check out the second
>> example on
>> the Script component reference:
>>
>> http://jakarta.apache.org/tapestry/3.0.3/doc/ComponentReference/
>> Script.html
>>
>> It works the same way in 4.0...
>>
>> Cheers,
>> Mark
>>
>> On 8/11/05, Rhys Causey <rh...@technolog.ca> wrote:
>>
>>
>>> Hi,
>>>
>>> I've actually been wondering about this as well. I need this
>>> type of
>>> functionality in order to get my DHTML component to work.
>>>
>>> If anyone knows how to do this, please explain.
>>>
>>> Thanks.
>>>
>>> On 11-Aug-05, at 3:12 PM, X. Y. Zhao wrote:
>>>
>>>
>>>
>>>> Hello again.
>>>>
>>>> I would like to know how it is possible (tap 4) to have client-side
>>>> javascript update the value of a hidden input form, which in turn
>>>> is submitted to the server and it's value is read by a tapestry
>>>> form listener.
>>>>
>>>> For example:
>>>>
>>>> Template.html:
>>>>
>>>> <form jwcid="@Form" listener="listener:doSubmit"
>>>> onSubmit="updateField()">
>>>> <input jwcid="@Hidden" value="ognl:value" id="FIELD"/>
>>>> <input jwcid="@Submit"/>
>>>> </form>
>>>> <script language="javascript">
>>>> function updateField() {
>>>> document.getElementById("FIELD").value = "test";
>>>> }
>>>> </script>
>>>>
>>>> Template.java:
>>>>
>>>> public abstract String getValue();
>>>> ...
>>>> public void doSubmit() {
>>>> log.debug(getValue().equals("test")); // <-- can i accomplish
>>>> this?
>>>> }
>>>>
>>>> Thanks for any help.
>>>>
>>>> -------------------------------------------------------------------
>>>> --
>>>> To unsubscribe, e-mail: tapestry-user-
>>>> unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail: tapestry-user-
>>>> help@jakarta.apache.org
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>> --------------------------------------------------------------------
>>> -
>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tapestry-user-
>>> help@jakarta.apache.org
>>>
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-
>> help@jakarta.apache.org
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Client-side updating input fields
Posted by Rhys Causey <rh...@technolog.ca>.
Hi,
Thanks for your response.
From what I've read, it seems like this is a good way to access
Tapestry-created elements, but is it possible to actually change
their values? I would have to set the value of the hidden field on
the client side.
Thanks.
On 11-Aug-05, at 3:33 PM, Mark Dillon wrote:
> I do this with the @Script component. Check out the second example on
> the Script component reference:
>
> http://jakarta.apache.org/tapestry/3.0.3/doc/ComponentReference/
> Script.html
>
> It works the same way in 4.0...
>
> Cheers,
> Mark
>
> On 8/11/05, Rhys Causey <rh...@technolog.ca> wrote:
>
>> Hi,
>>
>> I've actually been wondering about this as well. I need this type of
>> functionality in order to get my DHTML component to work.
>>
>> If anyone knows how to do this, please explain.
>>
>> Thanks.
>>
>> On 11-Aug-05, at 3:12 PM, X. Y. Zhao wrote:
>>
>>
>>> Hello again.
>>>
>>> I would like to know how it is possible (tap 4) to have client-side
>>> javascript update the value of a hidden input form, which in turn
>>> is submitted to the server and it's value is read by a tapestry
>>> form listener.
>>>
>>> For example:
>>>
>>> Template.html:
>>>
>>> <form jwcid="@Form" listener="listener:doSubmit"
>>> onSubmit="updateField()">
>>> <input jwcid="@Hidden" value="ognl:value" id="FIELD"/>
>>> <input jwcid="@Submit"/>
>>> </form>
>>> <script language="javascript">
>>> function updateField() {
>>> document.getElementById("FIELD").value = "test";
>>> }
>>> </script>
>>>
>>> Template.java:
>>>
>>> public abstract String getValue();
>>> ...
>>> public void doSubmit() {
>>> log.debug(getValue().equals("test")); // <-- can i accomplish
>>> this?
>>> }
>>>
>>> Thanks for any help.
>>>
>>> --------------------------------------------------------------------
>>> -
>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tapestry-user-
>>> help@jakarta.apache.org
>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-
>> help@jakarta.apache.org
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Client-side updating input fields
Posted by Mark Dillon <md...@gmail.com>.
I do this with the @Script component. Check out the second example on
the Script component reference:
http://jakarta.apache.org/tapestry/3.0.3/doc/ComponentReference/Script.html
It works the same way in 4.0...
Cheers,
Mark
On 8/11/05, Rhys Causey <rh...@technolog.ca> wrote:
> Hi,
>
> I've actually been wondering about this as well. I need this type of
> functionality in order to get my DHTML component to work.
>
> If anyone knows how to do this, please explain.
>
> Thanks.
>
> On 11-Aug-05, at 3:12 PM, X. Y. Zhao wrote:
>
> > Hello again.
> >
> > I would like to know how it is possible (tap 4) to have client-side
> > javascript update the value of a hidden input form, which in turn
> > is submitted to the server and it's value is read by a tapestry
> > form listener.
> >
> > For example:
> >
> > Template.html:
> >
> > <form jwcid="@Form" listener="listener:doSubmit"
> > onSubmit="updateField()">
> > <input jwcid="@Hidden" value="ognl:value" id="FIELD"/>
> > <input jwcid="@Submit"/>
> > </form>
> > <script language="javascript">
> > function updateField() {
> > document.getElementById("FIELD").value = "test";
> > }
> > </script>
> >
> > Template.java:
> >
> > public abstract String getValue();
> > ...
> > public void doSubmit() {
> > log.debug(getValue().equals("test")); // <-- can i accomplish
> > this?
> > }
> >
> > Thanks for any help.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Client-side updating input fields
Posted by Rhys Causey <rh...@technolog.ca>.
Hi,
I've actually been wondering about this as well. I need this type of
functionality in order to get my DHTML component to work.
If anyone knows how to do this, please explain.
Thanks.
On 11-Aug-05, at 3:12 PM, X. Y. Zhao wrote:
> Hello again.
>
> I would like to know how it is possible (tap 4) to have client-side
> javascript update the value of a hidden input form, which in turn
> is submitted to the server and it's value is read by a tapestry
> form listener.
>
> For example:
>
> Template.html:
>
> <form jwcid="@Form" listener="listener:doSubmit"
> onSubmit="updateField()">
> <input jwcid="@Hidden" value="ognl:value" id="FIELD"/>
> <input jwcid="@Submit"/>
> </form>
> <script language="javascript">
> function updateField() {
> document.getElementById("FIELD").value = "test";
> }
> </script>
>
> Template.java:
>
> public abstract String getValue();
> ...
> public void doSubmit() {
> log.debug(getValue().equals("test")); // <-- can i accomplish
> this?
> }
>
> Thanks for any help.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org