Right away I'd question whether or not "samplefield" really exists as an
element on the page I'm referencing.

Do a view-source of your page. Can you find an html block that has the exact
text >id="samplefield"< ?

If that doesn't turn up anything then I'd drop into my firefox FireBug
console and type something like this:

"alert(dojo.byId("samplefield"))"

If you get back "undefined" then there is no element on your page with that
id, if you do get it back then you have to try other things...Like possibly
chaning the events="onFocus" text to events="onFocus" or events="onBlur"
just to see if it's that.

Please do report back with any updates, I'd like to see any problems people
have with things so I can fix them. There's really no excuse to ~not~ have
everything be intuitive now that I get to play inside tapestry itself :) (ie
I could possibly check the outgoing html content and verify whether or not
an element with id >blah< exists...Could be bad for performance but we'll
see what's happening first...)

On 7/26/06, Alexandru Dragomir <[EMAIL PROTECTED]> wrote:

Hello!

I'm still trying to get around the @EventListener.

In the working TimeTracker application (part of tapestry example
applications) i added the following snipets of code :

In Home.html , in the form (taskForm) :

<div><span jwcid="samplefield"></span></div>

In Home.html , outside the form :

<div jwcid="[EMAIL PROTECTED]">
        <h2 style="clear:left"><span jwcid="@Insert"
value="ognl:sampledescription"/></h2>
</div>

In the java file :

@Component(type="TextField" ,id="samplefield" ,
            bindings={"value=sampledescription"})
    public abstract TextField  getSamplefield();
    public abstract String getSampledescription();




@EventListener(events="onFocus",elements="samplefield",submitForm="taskForm",async=true)
    public void sampleDataChanged(IRequestCycle cycle) {
        cycle.getResponseBuilder().updateComponent("sampleUpdateBlock");
    }

Here is also the generated script :

dojo.event.connect(dojo.byId("samplefield"), "onFocus", function(e){
                    var content={beventname:"onFocus"};
                    tapestry.event.buildEventProperties(e, content);
                    if (!content["beventtarget.id"])
content["beventtarget.id"]="samplefield";


                    tapestry.form.submitAsync("taskForm", content);

                });



On doing the event nothing happens on the client side. I checked with
FireBug debugger and there is no request sent to server.
Also , i tried with "targets" instead of "elements" and i also tried other
events.

On the other hand , if i keep the text field  and the update block but the
event listener listens to the already working widget (autocompleter) of
the
timetracker application the update block gets perfectly updated... (so at
least i'm certain that there are no typos)

I'm still digging into it... but if anybody knows an easier way to solve
it
i'd be happy to hear it !

Thanks !

Alex




--
Jesse Kuhnert
Tacos/Tapestry, team member/developer

Open source based consulting work centered around
dojo/tapestry/tacos/hivemind.

Reply via email to