[html-formfu] add url to Cancel button

Jonas Alves jonas.alves at gmail.com
Tue Oct 23 14:57:33 GMT 2007


On 23/10/2007, Carl Franks <fireartist at gmail.com> wrote:
>
> On 23/10/2007, kewei xiao <kewei.xiao at nald.ca> wrote:
> > Hi Carl
> >
> >    I am trying to add a url to my cancel button, so when I click cancel,
> > it will direct me to main page.
> >
> >    here is what I've done so far:
> >
> >     - type: Block
> >     elements:
> >       - type: Submit
> >         name: ok
> >         id: ok
> >         default_loc: "Ok"
> >         retain_default: 1
> >       - type: Button
> >         name: cancel
> >         default_loc: "Cancel"
> >         attributes_xml: { onclick: "<a href=3D'_uri_for(/admin)_'></a>"=
 }


You can't have an <a href=3D"..."> inside an onclick event. What you want is
something like:

attributes_xml: { onclick: 'location.href =3D "_uri_for(/admin)_" ' }

But like Carl as said that is not accessible.

>
> > Can you give me a hint on this?
>
> Have you tried it?
> If it doesn't work, what happens?
>
> Personally, I don't like solutions that only work with JavaScript, so
> I'm not especially inclined to investigate.
>
> There's a message in the archives [1] that explains how to get Cancel
> buttons working - though it also contains a link to Jakob Nielsen's
> "Reset / Cancel Button Considered Harmful" [2] ;)
>
> [1] http://lists.scsys.co.uk/pipermail/html-formfu/2007-August/000264.html
> [2] http://www.useit.com/alertbox/20000416.html
>
> Carl


-- =

Jonas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/html-formfu/attachments/20071023/c4=
6f2f73/attachment.htm


More information about the HTML-FormFu mailing list