Hi,

I was just about to reply and say I solved it. Missing slash in the location.href. The following works:

<input type="button" id="cancelButton" value="Cancel" onclick="location.href='/Administration';"/>

thanks for your help.

p.


Quoting Martijn Brinkers <[EMAIL PROTECTED]>:

I'm not sure but I thinks it's a similar problem. It looks like
Administration is interpreted as the context.

If you want to cancel the page it's easier to use the t5Component Button
component.

Add t5Component jar to you project (see
http://code.google.com/p/tapestry5-components/) and add this to
the .tml:

<button t:type="t5components/Button" type="button"
t:event="cancel">Cancel</button>


And add an event handler in your page:

protected Object onCancel()
{
  return Administration.class; // The Page to redirect to
}


Martijn Brinkers


On Fri, 2008-08-29 at 12:09 +0100, [EMAIL PROTECTED] wrote:
Thanks for the fast reply Martijn; that fixed the GIF asset.

However, I am still having problems with the Cancel button. I can
reference the Administration page as an asset, but obviously it then
does not get processed by Tapestry.

Thoughts, anyone?

  <input type="button" id="cancelButton" value="Cancel"
  onclick="location.href='Administration';"/>


p.


Quoting Martijn Brinkers <[EMAIL PROTECTED]>:

> I think the following happens
>
> The gif is requested by your page because of the IMG so the GET for the
> IMG looks something like
>
> http://YOUR_DOMAIN/YOUR_PAGE/bl_red_hundred.gif
>
> Now you page assumes this is your activation context and tries to
> convert it to int (which it's not).
>
> I think you can solve this by adding an image Asset. Another option I
> think would be to not request the image relative to your page but from
> for example the /images subir (make sure the request if relative with
> respect to you app root and not absolute).
>
> I guess the other problem is related.
>
> Martijn Brinkers
>
> On Fri, 2008-08-29 at 11:23 +0100, [EMAIL PROTECTED] wrote:
>> I don't quite understand why the following does not work and produces:
>>
>> TapestryModule.RequestExceptionHandler Processing of request failed
>> with uncaught exception: Exception in method
>> uk.bl.dportal.pages.EditUser.onActivate(int) (at EditUser.java:40),
>> parameter #1: Coercion of bl_red_hundred.gif to type java.lang.Integer
>> (via String --> Long, Long --> Integer) failed: For input string:
>> "bl_red_hundred.gif"
>> org.apache.tapestry5.runtime.ComponentEventException: Exception in
>> method uk.bl.dportal.pages.EditUser.onActivate(int) (at
>> EditUser.java:40), parameter #1: Coercion of bl_red_hundred.gif to
>> type java.lang.Integer (via String --> Long, Long --> Integer) failed:
>> For input string: "bl_red_hundred.gif"
>>        at
>> org.apache.tapestry5.internal.structure.ComponentPageElementImpl.triggerContextEvent(ComponentPageElementImpl.java:1054)
>> ...
>>
>>
>> I have a template which containes a reference to a gif used in the
>> banner (BLTemplate.tml):
>>
>> <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
>>      <head>
>>          <title>Digital Portal: ${heading}</title>
>>      </head>
>>      <body>
>>          <div class="nav-top" style="background: #CF0000; float:left;
>> height:125px; width:5%;">
>>                        <img src="bl_red_hundred.gif" alt="bl" />
>>                </div>
>>        <div style="background: #CF0000; float:right; height:125px;
>> width:95%">
>>                <h1>${title}</h1>
>>          </div>
>>
>>        <div style="height:100%;">
>>          <t:body/>
>>        </div>
>> ...
>>
>>
>> This template is used for all my pages (in this case EditUser.tml):
>>
>> <html t:type="BLTemplate" t:heading="literal:Edit User Details"
>>                                                t:title="literal:Edit User 
Details"
>>                                                
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
>>      <body>
>>      <p><h3>Edit user details.</h3></p>
>> ...
>>
>>
>> This page is called from a link produced by the Grid component (in
>> ManageUsers.tml):
>>
>>        <t:grid t:source="allUsers" t:reorder="userName"
>> t:exclude="id,password" t:row="listItem">
>>                        <t:parameter t:name="userNameCell">
>>                                <t:PageLink t:page="editUser" 
t:context="listItem.id">
>>                                        ${listItem.userName}
>>                                </t:PageLink>
>>                        </t:parameter>
>>        </t:grid>
>>
>>
>> and EditUser.java has an onActivate with a parameter:
>>
>>        public void onActivate(int id)
>>        {
>>                Query query = session.createQuery("from User where id = 
'"+id+"'");
>>                List result = query.list();
>>                user = (User)result.get(0);
>>        }
>>
>>
>> Why is the GIF name being passed in initially?  The page still works,
>> so the id is being set to that given by the link from ManageUsers.tml.
>> The exception is generated but it continues on to display the page.
>>
>> However, I have a Cancel button on the EditUser page, and when I press
>> that the whole lot fails with a coercion error, this time trying to
>> take the name of the page from the Cancel button and pass it as a
>> parameter:
>>
>> (EditUser.tml):
>>
>> <input type="button" id="cancelButton" value="Cancel"
>> onclick="location.href='Administration';"/>
>>
>>
>> producing exception:
>>
>> Exception in method uk.bl.dportal.pages.EditUser.onActivate(int) (at
>> EditUser.java:36), parameter #1: Coercion of Administration to type
>> java.lang.Integer (via String --> Long, Long --> Integer) failed: For
>> input string: "Administration"
>>
>>
>> What is going on and why does this happen? It's only happening for
>> this page which has an onActivate with a parameter. All my other pages
>> work as expected.
>>
>> thanks,
>> p.
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>




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



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






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

Reply via email to