You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ying Lee <yi...@hotmail.com> on 2007/07/23 18:10:37 UTC

Editable table and DirectLink

Greetings all,

I am using Tapestry 4.0 and trying to make a simple shopping area that shows 
a table of items, and each row has a textfield where users can input the 
quantity they want to buy, and I want to add a DirectLink for each row so 
that it will send a purchase action for that particular item, pretty 
standard stuff.

I am able to embed the item ID in the DirectLink parameter list (using 
"parameters" attribute), but I could not get the user input for the Quantity 
textfield once the link calls the Listener.

I can wrap the table in a form, then put a submit button to submit all 
changes altogether, in that case I would look at the data in my 
implementation of IBasicTableModel (which queries the database, and store 
the data in a list) and see which row has a non-zero quantity value, which 
indicates the user wants to purchase that particular item in the specified 
quantity. However I also want to provide user the option to purchase each 
item individually by clicking on the DirectLink at the end of the row.

I notice the HTML of the DirectLink has my itemID encoded, so how can I get 
the Quantity value at runtime encode in the link as parameters?? The values 
of editable fields in a form are not submitted to the page's until the 
"submit" button is pressed....

thx.

Ron

_________________________________________________________________
Learn English via Shopping Game, FREE! 
http://www.linguaphonenet.com/BannerTrack.asp?EMSCode=MSN06-03ETFJ-0211E


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


Re: Editable table and DirectLink

Posted by Jesse Kuhnert <jk...@gmail.com>.
If you feel like living on the edge (not really, but it's a snapshot build)
- the InlineEditBox supports listener/parameter stuff and allows you to do
this sort of thing you are doing. (I think? )

http://tapestry.apache.org/tapestry4.1/components/dojo/inlineeditbox.html

On 7/23/07, Ying Lee <yi...@hotmail.com> wrote:
>
>
> Thanks for replying!
>
> I haven't tried this approach, but I will give it a shot.
>
> The difficulty here is that how do I get the "valueFromInputField"? Since
> each row has its own TextField that accepts input, and I think that
> Tapestry
> will automatically assign unique ID (correct me if I am wrong) for each
> textfield, so the javascript must need to know which row's DirectLink is
> being clicked on, and then what is the "counter" that is used by Tapestry
> to
> construct the textfield DOM component's ID, and then I can use that ID to
> get the component's input value...
>
> I will think a little bit in this direction and if I find a solution I
> will
> let you all know..
>
> Also other suggestions are still welcome!
>
> Ron
>
> >From: Shing Hing Man <ma...@yahoo.com>
> >Reply-To: "Tapestry users" <us...@tapestry.apache.org>
> >To: Tapestry users <us...@tapestry.apache.org>
> >Subject: Re: Editable table and DirectLink
> >Date: Mon, 23 Jul 2007 13:05:04 -0700 (PDT)
> >
> >Have you tried the following ?
> >
> ><script ...>
> >function append() {
> >   window.location =
> >document.anchors.link1.href+"&sp=s"+valueFromInputField
> >}
> ></script>
> >
> >
> ><a id="link1" jwcid="@DirectLink"
> >onclick="append()">foo</a>
> >
> >where append() is a javascript function that
> >appends the value of your input field to the
> >Directlink
> >URL.
> >
> >Shing
> >
> >
> >--- Ying Lee <yi...@hotmail.com> wrote:
> >
> > > Greetings all,
> > >
> > > I am using Tapestry 4.0 and trying to make a simple
> > > shopping area that shows
> > > a table of items, and each row has a textfield where
> > > users can input the
> > > quantity they want to buy, and I want to add a
> > > DirectLink for each row so
> > > that it will send a purchase action for that
> > > particular item, pretty
> > > standard stuff.
> > >
> > > I am able to embed the item ID in the DirectLink
> > > parameter list (using
> > > "parameters" attribute), but I could not get the
> > > user input for the Quantity
> > > textfield once the link calls the Listener.
> > >
> > > I can wrap the table in a form, then put a submit
> > > button to submit all
> > > changes altogether, in that case I would look at the
> > > data in my
> > > implementation of IBasicTableModel (which queries
> > > the database, and store
> > > the data in a list) and see which row has a non-zero
> > > quantity value, which
> > > indicates the user wants to purchase that particular
> > > item in the specified
> > > quantity. However I also want to provide user the
> > > option to purchase each
> > > item individually by clicking on the DirectLink at
> > > the end of the row.
> > >
> > > I notice the HTML of the DirectLink has my itemID
> > > encoded, so how can I get
> > > the Quantity value at runtime encode in the link as
> > > parameters?? The values
> > > of editable fields in a form are not submitted to
> > > the page's until the
> > > "submit" button is pressed....
> > >
> > > thx.
> > >
> > > Ron
> > >
> > >
> >_________________________________________________________________
> > > Learn English via Shopping Game, FREE!
> > >
> >http://www.linguaphonenet.com/BannerTrack.asp?EMSCode=MSN06-03ETFJ-0211E
> > >
> > >
> > >
> >---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail:
> > > users-help@tapestry.apache.org
> > >
> > >
> >
> >
> >Home page : http://www.lombok.demon.co.uk/
> >
> >
> >
> >       ___________________________________________________________
> >Yahoo! Mail is the world's favourite email. Don't settle for less, sign
> up
> >for
> >your free account today
> >
> http://uk.rd.yahoo.com/evt=44106/*http://uk.docs.yahoo.com/mail/winter07.html
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> >For additional commands, e-mail: users-help@tapestry.apache.org
> >
>
> _________________________________________________________________
> Get 10Mb extra storage for MSN Hotmail. Subscribe Now!
> http://join.msn.com/?pgmarket=en-hk
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
Jesse Kuhnert
Tapestry/Dojo team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind. http://blog.opencomponentry.com

Re: Editable table and DirectLink

Posted by Ying Lee <yi...@hotmail.com>.
Thanks for replying!

I haven't tried this approach, but I will give it a shot.

The difficulty here is that how do I get the "valueFromInputField"? Since 
each row has its own TextField that accepts input, and I think that Tapestry 
will automatically assign unique ID (correct me if I am wrong) for each 
textfield, so the javascript must need to know which row's DirectLink is 
being clicked on, and then what is the "counter" that is used by Tapestry to 
construct the textfield DOM component's ID, and then I can use that ID to 
get the component's input value...

I will think a little bit in this direction and if I find a solution I will 
let you all know..

Also other suggestions are still welcome!

Ron

>From: Shing Hing Man <ma...@yahoo.com>
>Reply-To: "Tapestry users" <us...@tapestry.apache.org>
>To: Tapestry users <us...@tapestry.apache.org>
>Subject: Re: Editable table and DirectLink
>Date: Mon, 23 Jul 2007 13:05:04 -0700 (PDT)
>
>Have you tried the following ?
>
><script ...>
>function append() {
>   window.location =
>document.anchors.link1.href+"&sp=s"+valueFromInputField
>}
></script>
>
>
><a id="link1" jwcid="@DirectLink"
>onclick="append()">foo</a>
>
>where append() is a javascript function that
>appends the value of your input field to the
>Directlink
>URL.
>
>Shing
>
>
>--- Ying Lee <yi...@hotmail.com> wrote:
>
> > Greetings all,
> >
> > I am using Tapestry 4.0 and trying to make a simple
> > shopping area that shows
> > a table of items, and each row has a textfield where
> > users can input the
> > quantity they want to buy, and I want to add a
> > DirectLink for each row so
> > that it will send a purchase action for that
> > particular item, pretty
> > standard stuff.
> >
> > I am able to embed the item ID in the DirectLink
> > parameter list (using
> > "parameters" attribute), but I could not get the
> > user input for the Quantity
> > textfield once the link calls the Listener.
> >
> > I can wrap the table in a form, then put a submit
> > button to submit all
> > changes altogether, in that case I would look at the
> > data in my
> > implementation of IBasicTableModel (which queries
> > the database, and store
> > the data in a list) and see which row has a non-zero
> > quantity value, which
> > indicates the user wants to purchase that particular
> > item in the specified
> > quantity. However I also want to provide user the
> > option to purchase each
> > item individually by clicking on the DirectLink at
> > the end of the row.
> >
> > I notice the HTML of the DirectLink has my itemID
> > encoded, so how can I get
> > the Quantity value at runtime encode in the link as
> > parameters?? The values
> > of editable fields in a form are not submitted to
> > the page's until the
> > "submit" button is pressed....
> >
> > thx.
> >
> > Ron
> >
> >
>_________________________________________________________________
> > Learn English via Shopping Game, FREE!
> >
>http://www.linguaphonenet.com/BannerTrack.asp?EMSCode=MSN06-03ETFJ-0211E
> >
> >
> >
>---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail:
> > users-help@tapestry.apache.org
> >
> >
>
>
>Home page : http://www.lombok.demon.co.uk/
>
>
>
>       ___________________________________________________________
>Yahoo! Mail is the world's favourite email. Don't settle for less, sign up 
>for
>your free account today 
>http://uk.rd.yahoo.com/evt=44106/*http://uk.docs.yahoo.com/mail/winter07.html
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>For additional commands, e-mail: users-help@tapestry.apache.org
>

_________________________________________________________________
Get 10Mb extra storage for MSN Hotmail. Subscribe Now! 
http://join.msn.com/?pgmarket=en-hk


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


Re: Editable table and DirectLink

Posted by Shing Hing Man <ma...@yahoo.com>.
Have you tried the following ?

<script ...>
function append() {
  window.location =
document.anchors.link1.href+"&sp=s"+valueFromInputField
}
</script>


<a id="link1" jwcid="@DirectLink"
onclick="append()">foo</a>

where append() is a javascript function that
appends the value of your input field to the
Directlink
URL.

Shing


--- Ying Lee <yi...@hotmail.com> wrote:

> Greetings all,
> 
> I am using Tapestry 4.0 and trying to make a simple
> shopping area that shows 
> a table of items, and each row has a textfield where
> users can input the 
> quantity they want to buy, and I want to add a
> DirectLink for each row so 
> that it will send a purchase action for that
> particular item, pretty 
> standard stuff.
> 
> I am able to embed the item ID in the DirectLink
> parameter list (using 
> "parameters" attribute), but I could not get the
> user input for the Quantity 
> textfield once the link calls the Listener.
> 
> I can wrap the table in a form, then put a submit
> button to submit all 
> changes altogether, in that case I would look at the
> data in my 
> implementation of IBasicTableModel (which queries
> the database, and store 
> the data in a list) and see which row has a non-zero
> quantity value, which 
> indicates the user wants to purchase that particular
> item in the specified 
> quantity. However I also want to provide user the
> option to purchase each 
> item individually by clicking on the DirectLink at
> the end of the row.
> 
> I notice the HTML of the DirectLink has my itemID
> encoded, so how can I get 
> the Quantity value at runtime encode in the link as
> parameters?? The values 
> of editable fields in a form are not submitted to
> the page's until the 
> "submit" button is pressed....
> 
> thx.
> 
> Ron
> 
>
_________________________________________________________________
> Learn English via Shopping Game, FREE! 
>
http://www.linguaphonenet.com/BannerTrack.asp?EMSCode=MSN06-03ETFJ-0211E
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail:
> users-help@tapestry.apache.org
> 
> 


Home page : http://www.lombok.demon.co.uk/



      ___________________________________________________________ 
Yahoo! Mail is the world's favourite email. Don't settle for less, sign up for
your free account today http://uk.rd.yahoo.com/evt=44106/*http://uk.docs.yahoo.com/mail/winter07.html 

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