Mike,
Success! I entered your example below and got the results I wanted. Of
course I'll have to remove the alert. The example I used was:
A*%%WB 7 FLD onDblClick="alert('hello');<wf:js
function="setFieldValueAndS+
A*%%WB +ubmit"/>(this,'?','&{WEBFACINGFORMID}');"
Thank you,
Gilbert Victor Urias
Ruan Transport Management Systems
Where Safety Is First!
515-245-2458 - Work
515-875-5000 - Fax
-----Original Message-----
From: wdsci-l-bounces@xxxxxxxxxxxx [mailto:wdsci-l-bounces@xxxxxxxxxxxx]
On Behalf Of Mike Hockings
Sent: Wednesday, January 14, 2009 1:06 PM
To: Websphere Development Studio Client for iSeries
Subject: Re: [WDSCI-L] WebFacing onDblClick inserting a '?' in a field
Hi Gilbert,
You don't really want to add the hyper link (<A> tag ) stuff as that
will
just make things incorrect. Try something like this and see if it works
for you.
A*%%WB 7 FLD onDblClick="alert('hello');<wf:js
function="setFieldValueAndS+
A*%%WB +ubmit"/>(&{SN50B.S50MF.REF},'?','&{WEBFACINGFORMID}');"
It should generate something like this.
onDblClick="alert('hello');<wf:js function="setFieldValueAndSubmit"/>
(document.<%=(String)session.getAttribute("UniqueId")%>.l<%=zOrder%>
_SN50B$S50MF,'?','<%=(String)session.getAttribute("UniqueId")%>');"
Then resolve to this when it runs
onDblClick="c_i_e_i_w_7006_setFieldValueAndSubmit(document.SCREEN.l1_SN5
0B$S50MF,'?','SCREEN');"
So as you can see the end result is simply HTML so there are lots of
good
references about HTML and JavaScript that are probably more elegant than
what I can suggest :). However there are some useful things to note
here.
I wrote a JSP custom tag for WebFacing that will prefix WebFacing
JavaScript function names with the current version qualifier. That way
you don't have to tinker with each release. Extracted from the above,
the
custom tag was <wf:js function="setFieldValueAndSubmit"/>. You just
give
it the function name, in this case "setFieldValueAndSubmi" and it will
modify it for the current version. For me that resulted in
"c_i_e_i_w_7006_setFieldValueAndSubmit" but for you it may be different
as
it depends on the version of WebFacing. I also used the replacement
value
for the form id of &{WEBFACINGFORMID}. For Web-only uses WebFacing will
default to a form id of SCREEN but if you are using Portal then the form
id for the portlet instance will be unique. Lastly, in this example I
used the explicit record and field name that you specified. However
for
your use it would probably be simpler just to use *this* since you are
referencing the current element.
A*%%WB 7 FLD onDblClick="alert('hello');<wf:js
function="setFieldValueAndS+
A*%%WB +ubmit"/>(this,'?','&{WEBFACINGFORMID}');"
If you find that the onDblClick gets jammed up to the element before it
with no space between then just put a newline in the Web Setting entry
field and it will generate something like this:
A*%%WB 7 FLD +
A*%%WB +\r\nonDblClick="alert('hello');<wf:js
function="setFieldValueAndSu+
A*%%WB +bmit"/>(this,'?','&{WEBFACINGFORMID}');"
Let me know how it works out.
Mike
Mike Hockings, P.Eng.
System i Application Development Tools
IBM Canada Ltd. Laboratory
hockings@xxxxxxxxxx
voice 1-905-413-3199 T/L 313-3199 ITN 23133199
wdsci-l-bounces@xxxxxxxxxxxx wrote on 01/14/2009 11:54:57 AM:
Mike,
I have had some success using you recommendations. The first one
yields
the question mark in the field but does not force the (Enter) key:
A*%%WB 7 FLD <A href=# ondblClick="this.value='?';"></A placed in the
HtmlInside
Your second recommendation is a little unclear to me. I imagine this
will do what I want which is to place the '?' in the field and force
the
enter key.
A*%%WB 7 FLD <A href=# onDblClick="<wf:js
function="setFieldValueAndSubmit"/>('this','?', 'SCREEN')
The parms are the id of the field, the field value and the form id.
I'm working with Display file S#DP507, Record format SN50B and field
where I want to put the '?' is S50MF. So if you would, please
elaborate
on the parms you reference above.
Thank you,
Gilbert Victor Urias
Ruan Transport Management Systems
Where Safety Is First!
515-245-2458 - Work
515-875-5000 - Fax
As an Amazon Associate we earn from qualifying purchases.