Ok. Today I tried the suggestion of appending the value to the DirectLink URL, and it is working.

The way to solve "how to get the valueFromInputField on a particular row" is to define a counter attribute in my row object, and on the server side it will assign the row index (0,1,2,..) as part of my row object (which is stored in a list in my basicTableModel). And I embed that index in the informal param "id" attribute of my DirectLink (i.e. "addlink_0", "addlink_1") thru that row object:
<component .. type="DirectLink">
 <binding name="id" value="ognl:'addLink_' + rowObj.index"/>
</component>

And this will allow me to get the index from the id when the DirectLink's javascript function is triggered. And using that index I can figure out the id of the textfield component on that row, since the id of that textfield is in the form of "{id_name}_{index}", (except the first one which only has the id_name).

In the .page file, the DirectLink also needs to declare a placeholder parameter that the page is expecting. For example if the texfield is suppose to get user's "Quantity" input, then I will also need to define it in my parameter list and give a default value (zero in my case):
....
<binding name="parameters" value="ognl:{.... , 'quantity=0' }"/>

And when the "append" function is triggered, it will locate that parameter in the encoded URL (&amp;sp=Squantity%3D0), and replace the 0 with the user's input.

Note that if I want to have multiple editable table cells, replace the input for each parameter on the URL is kind of painful.. Hope that the future version of Tapestry will have a much easy way to handle Editable Tables with directlinks.

By the way, thx for all your suggestions. I have posted another issue I found that has to do with "submit doesn't work properly for two editable tables on the same page", hope that one has a solution...

Ronald

From: "Jesse Kuhnert" <[EMAIL PROTECTED]>
Reply-To: "Tapestry users" <users@tapestry.apache.org>
To: "Tapestry users" <users@tapestry.apache.org>
Subject: Re: Editable table and DirectLink
Date: Wed, 25 Jul 2007 22:29:11 -0400

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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]>
>Reply-To: "Tapestry users" <users@tapestry.apache.org>
>To: Tapestry users <users@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 <[EMAIL PROTECTED]> 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:
> > [EMAIL PROTECTED]
> > For additional commands, e-mail:
> > [EMAIL PROTECTED]
> >
> >
>
>
>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: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>

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


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




--
Jesse Kuhnert
Tapestry/Dojo team member/developer

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

_________________________________________________________________
No masks required! Use MSN Messenger to chat with friends and family. http://go.msnserver.com/HK/25382.asp


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

Reply via email to