<br><br><div class="gmail_quote">2009/5/11 Ryan Lubke <span dir="ltr">&lt;<a href="mailto:Ryan.Lubke@sun.com">Ryan.Lubke@sun.com</a>&gt;</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>
&lt;composite:interface&gt;...&lt;/composite:interface&gt;<br>
..<br>
&lt;composite:implementation&gt;<br>
&lt;script type=&quot;text/javascript&quot;&gt;<br>
                function checkForm(form) {<br>
                  var name = form[&#39;#{cc.clientId}:name&#39;].value;<br>
                  var pwd = form[&#39;#{cc.clientId}:password&#39;].value;<br>
<br>
                  if (name == &quot;&quot; || pwd == &quot;&quot;) {<br>
                    alert(&quot;Please enter name and password.&quot;);<br>
                    return false;<br>
                  }<br>
                  return true;<br>
                }<br>
&lt;/script&gt;<br>
  ...<br>
&lt;/composite:implementation&gt;<br>
<br>
I have components with &quot;name&quot; and &quot;password&quot; 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>
&lt;composite:interface&gt;...&lt;/composite:interface&gt;<br>
..<br>
&lt;composite:implementation&gt;<br>
&lt;h:outputScript library=&quot;components/login&quot; name=&quot;login.js&quot;/&gt;<br>
  ...<br>
&lt;/composite:implementation&gt;<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&#39;s a bug, is it not?<br>
</blockquote></div></div>
No, I don&#39;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&#39;s what I figured, but that&#39;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&#39;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&#39;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>