Re: WOBuilder JSImageFlyover cannot be a submit button
Re: WOBuilder JSImageFlyover cannot be a submit button
- Subject: Re: WOBuilder JSImageFlyover cannot be a submit button
- From: Denis Stanton <email@hidden>
- Date: Wed, 15 Oct 2003 07:51:46 +1300
Hi Jonathan
Thank you for a most excellent clarification of the workings of JS
flyovers, both in and outside WebObjects, and for pointing me to the
source code. Art also pointed out that I can roll my own, and told me
where the source code is. Although I was an html coder long before I
was a WebObjects builder I have tended to see much of what WebObjects
gives me as black-box magic and I don't think of going behind what's
given to tinker with the works.
I had figured out that WO does not provide for adding additional tags
to the IMG tag within JSImageFlyover,
..."width/height/alt bindings to the existing JSImageFlyover, such
that they
are added to the internal IMG tag. [I believe the problem with the
existing JSImageFlyover is that it adds these attributes to the A tag,
where they don't mean anything.]
The bit that hadn't occurred to me is
2) Modify the source of JSImageFlyover. Apple does conveniently give
you
the source code.
Both you and Art pointed this out, and for me it was one of those
"Ahhh... (slaps head and slump back)" moments.
Thank you both. If only one of my ex-employers, for whom I laboured
long and hard with WebObjects, had been farsighted or generous enough
to send me to a WebObjects course way back I might have some of these
principles in my head already. Self-instruction from documentation and
"just do it" goes a long way, but it's easy to miss something really
clever but slightly off track.
Denis
On Wednesday, October 15, 2003, at 05:53 AM,
email@hidden wrote:
I think the most important point to remember is that WO is just
creating
HTML for the user, in the end. It's easy to forget this in WO, becuase
often you don't actually need to know what the HTML is doing. But this
is
a case where you do.
The JSImageFlyover is creating an HTML IMG tag wrapped in an HTML A
tag.
One problem you've run into is that the JSImageFlyover doesn't let you
set width, height and alt on the IMG tag that it's producing. This is
sort of a lack of feature in the JSImageFlyover. The solution is to
either to:
1) write your own component that does what JSImageFlyover does. Once
you
understand the HTML that needs to be generated, this is not that hard
to
do. or
2) Modify the source of JSImageFlyover. Apple does conveniently give
you
the source code. It shouldn't be too hard to add support for
width/height/alt bindings to the existing JSImageFlyover, such that
they
are added to the internal IMG tag. [I believe the problem with the
existing JSImageFlyover is that it adds these attributes to the A tag,
where they don't mean anything.] You can find the source inside the
JavaWOExtensions project, which is located on a Windows machine at
$NEXT_ROOT/Developer/Examples/JavaWebObjects/Source/. Once you open
the
project, you need to look in the "Javascript" subproject for the
JSImageFlyover component. Not sure where this is installed on OSX.
You could modify the source to support the height/width/alt, and save
it
under a new name, include it in one of your projects and frameworks,
and
use that new component. It's possible some other developer has already
done this and will share it (is there something in Project Wonder?).
Now, the problem of the JSImageFlyover not functioning as a form
submit,
is a different problem. Again, it requires an understanding of the
HTML
being generated, and the HTML you want to generate. An IMG tag wrapped
in an A tag is not a form submit button, it's just a link, which is a
different thing in HTML. The built in WOImageButton component will
output a graphical submit button for you. [This component does not
show
up in the pallete, you need to click the "*" button to add any
arbitrary
component, and then type in "WOSubmitButton".] However, the
WOSubmitButton doesn't support a 'flyover' image. Is it possible to
have
a graphical form submit button with a flyover, using HTML/Javascript?
I'm actually not sure, I've never done it. If it is possible, and you
want this, you need to again, write your own component which produces
this HTML. Again, the JSImageFlyover source may be a useful starting
point, although you want to produce different HTML tags. The source to
WOSubmitButton is NOT provided to us.
Understanding what HTML code you want generated is the first step.
Getting your WO app to generate that HTML code is the next. If
built-in
WO components don't exist to generate exactly the HTML code you need,
you
can still implement it yourself using the building blocks WO gives you.
Either as a re-useable component of your own (ideally), or in a pinch,
just as code within a page component that will output the HTML you
want.
[WOGenericContainer and WOGenericElement can be used to output any
arbitrary HTML code, for instance].
Hope this helps clarify some things for you,
--Jonathan
Denis Stanton
email@hidden
Home: (09) 533 0391
mobile: 021 1433622
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.