Thanks Volker,

You're right.
"forceId" however, doens't go for "inputHidden" & "SelectOneMenu". (TLD doc) Yet, adding the "container IDs" to the JS call (getElementByID ('contID + ownID') ) makes it work. :-)

Have they ever thought of making a kind of cascading resolver to solve issues like these?
(= following the ID-Tree of a page)
But I guess JS should have thought of that, not MyFaces... :-)

& Any idea for the first part of the question? Is such direct access (by index) of ArrayList elements possible?

Philippe

On 02 May 2006, at 11:57, Volker Weber wrote:

Hi Philippe,

To part B:
the generated html element ids are not the same as you set on the jsf
tags. I think this is the problem of your javascript.
This is not a bug! see http://wiki.apache.org/myfaces/forceId

If in doubt take a look into the generated html source for the ids.



Regards,
  Volker



Philippe Lamote wrote:
Nobody any idea?
Phil

Hi List,

I think I am stuck with a bug (B/) & I have a list-access element
question as well. (below: A/)

A/ As you will probabely wonder with the code below: what is this guy
trying to do with
these value="#{regcalbean.currentEvent.refDateDeltas[2]}" ??!
Well, I have an ArrayList and I wondered whether there is a way to
talking directly to an (Array -> indexed) element of this List.
Like you can talk directly to an array index in Java. (that's where I
stole the syntax)
I get no complaints, but... the List just doens 't get filled so this
must be wrong somehow :-)

I hope this is possible, if it is, a hint as to how to make this work is welcome! (I saw some methods smelling to what I want to do in a property resolver class, if I remember well, but I don't know how this translates
into front-end access)

I know I can make it work by creating indirection-vars (one/list
element) but that i sobviously far less elegant than if this direct
access would be possible. (less memory, less redundancy, less code, ...
and very intuitive)

B/
I think I came across a MyFaces-javascript integration bugs (at least
for 1.1.1 - donno whether it has already been mentioned or even better,
corrected in 1.1.2!)

The error I got on several occasions, was a "/element has no
properties/" error, whereas the element surely had props.

*Example 1:*

To construct a (js-) popup with some explanantion, but taking into
account internationalisation (hard req), I made a hidden text field
holding the var for when the JS needed it.
So in the page has this js: (header)

 function explainComplexData(){
var text = document.getElementById("justForJSPopup").value;
alert(text);}

& in the page itself: the img of a question mark which gives the
explanation when clicked upon:

<h:graphicImage
value="../pics/regCalNew/questionHelp.png" onclick="explainComplexData()"/>

& a hidden input field, just as a headless container for holding the
explanantion in the correct language.
<h:inputHidden id="justForJSPopup"
value="#{labels.newCal_explainComplex}" />

This unfortunately does not work with MyFaces. (what made it work:
change the inputHidden to a POHO (Plain Old HTML Object ;-) but then
i18n goes thru the window and of course I prefer to stick to one
compontent flavor)


*Example 2:* when checking a checkbox, 2 menus ("menu3" & "menu4" should
change their "disabled"-aspect.)
Setup: one checkbox to trigger this, one js to apply these changes and
of course the 2 selectMenus.
Code:

<h:selectBooleanCheckbox id="complexDeltaDateFlag"
value="#{regcalbean.currentEvent.refDateDeltas[2]}"
  onclick="javascript:enableFocus()"/>

<h:selectOneMenu
value="#{regcalbean.currentEvent.refDateDeltas[4]}" id="menu4">
  <f:selectItem ... (a few selectItems) />
</h:selectOneMenu>

& the js:
function enableFocus()
{
if(document.getElementById('menu3').disabled == true)
{
document.getElementById('menu3').disabled = false;
document.getElementById('menu4').disabled = false;
}
else {
document.getElementById('menu3').disabled =
true;document.getElementById('menu4').disabled = true;
}
}

... gives same error: the elements (menu3 & menu4 here) would have "no
properties"...


Frustrating!

Phil





--
Don't answer to From: address!
Mail to this account are droped if not recieved via mailinglist.
To contact me direct create the mail address by
concatenating my forename to my senders domain.

Reply via email to