<br><br><div class="gmail_quote">2009/5/11 Ryan Lubke <span dir="ltr"><<a href="mailto:Ryan.Lubke@sun.com">Ryan.Lubke@sun.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="h5">On 5/11/09 7:40 AM, David Geary wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I have a login composite component that looks like this:<br>
<br>
<composite:interface>...</composite:interface><br>
..<br>
<composite:implementation><br>
<script type="text/javascript"><br>
function checkForm(form) {<br>
var name = form['#{cc.clientId}:name'].value;<br>
var pwd = form['#{cc.clientId}:password'].value;<br>
<br>
if (name == "" || pwd == "") {<br>
alert("Please enter name and password.");<br>
return false;<br>
}<br>
return true;<br>
}<br>
</script><br>
...<br>
</composite:implementation><br>
<br>
I have components with "name" and "password" component ids in a form in the ... part of the implementation. That works fine.<br>
<br>
However, if I pull the JS out into its own file, and do this:<br>
<br>
<composite:interface>...</composite:interface><br>
..<br>
<composite:implementation><br>
<h:outputScript library="components/login" name="login.js"/><br>
...<br>
</composite:implementation><br>
<br>
h:outputScript puts the JS in the page, but the JS no longer works because the expression cc.clientId evaluates to an empty string.<br>
<br>
That's a bug, is it not?<br>
</blockquote></div></div>
No, I don't believe it is. The javascript file will be served in a separate request. There is no way to determine the<br>
component at that time.</blockquote><div><br>That's what I figured, but that's not going to be obvious to the average developer. This is a pretty serious violation of the principle of least astonishment, and JSF has enough of those violations, IMO.<br>
<br>If there's no way to make it work, it should be documented, preferably in the pdl (or is it vdl now?) docs that h:outputScript will not work when the corresponding JS references a composite component.<br><br><br>david<br>
<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">I haven't tried it, but I wonder if the flash could be used here?<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<br>
david<br>
<br>
<br>
<br>
</blockquote>
</blockquote></div><br>