Thanks Volker,
I already solved it with a javascript function.
In my application it would be ok to use forceId since I create the page
dynamically and so am able to set a counter on each id.
In any case I am adding a simple js function that allows you to search a
form (for multiple forms it needs some tweaking) and find an id.
For example if you have a JSF created id such as form0:datatable:0:id1
You can use the method to find this object by knowing 'id1' (gets the
first instance of 'id1')
function getFieldByElementName(destName) {
var formElements = document.forms[0].elements;
for(var i=0;i<formElements.length;i++){
var formField = formElements[i].id;
if(formField.indexOf(destName)!=-1){
//alert("this is
it:"+i+";"+formElements[i].id+";"+formElements[i].value);
return formElements[i];
}
}
return null;//if nothing found return null
}
Hope this helps,
Yaron
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Volker Weber
Sent: Friday, April 06, 2007 1:18 PM
To: MyFaces Discussion
Subject: Re: problem with forceId
Hi Yaron,
did you realy need forceId? I strongly dissuade from using this!
Imho forceId makes more problems than it solves,
and i dont know a case in which it is realy needed.
Anyway:
inputCalendar.getAttributes().put("forceId", "cal1");
should do it.
Reagards,
Volker
2007/4/6, Yaron Spektor <[EMAIL PROTECTED]>:
> Hi,
> Does anyone know how to use the force id in a component?
> I looked for an answer but could not see this even mentioned
anywhere...
>
> For example I use this tag:
> <t:inputCalendar id="cal1"
> renderAsPopup="true"
> popupDateFormat="MM/dd/yyyy"
> helpText="MM/DD/YYYY"
> renderPopupButtonAsImage ="true"
> onchange="setDateString('cal1','cal2')"
> forceId="true"
> size="7"
> />
>
> And I need id 'cal1' to be forced to true.
> When I try and do it with HtmlInputCalendar components I don't have
that
> option.
>
> HtmlInputCalendar inputCalendar = new HtmlInputCalendar();
> String fullSrcId=idPrefix+"_"+id;
> inputCalendar.setId(fullSrcId);
> inputCalendar.setRenderAsPopup(true);
> inputCalendar.setRenderPopupButtonAsImage(true);
> inputCalendar.setSize(7);
> inputCalendar.setPopupDateFormat("MM/dd/yyyy" );
> //FORCE ID???????
>
> Yaron
>