-
1. popupPanel controls javascript syntax?
iabughosh Apr 26, 2011 2:49 AM (in response to dwagmuse)Hi David,
i think you can use it i a regular js function, i have this sample working :
<script type="text/javascript">
function closePopup() {
window.alert("closing dialog ....");
#{rich:component('panel')}.hide();
return false;
}
</script>
regards.
-
2. popupPanel controls javascript syntax?
dwagmuse Apr 26, 2011 11:46 AM (in response to iabughosh)I'm sure you're right, but I must still be missing something. My javascript code is in a separate .js file that I'm pulling into the .html file using this:
<h:outputScript library="js" name="schedEvents.js" />
That worked fine until I added the new line with the popup control.
Now, when the page loads I get a javascript error complaining about "illegal character" on the line with the #.
I'm assuming that the # character must be some magic operator defined by jQuery or RichFaces, and that I need to somehow get that library imported first, but I can't find it documented anywhere...
Thanks for the help!
-
3. popupPanel controls javascript syntax?
dwagmuse Apr 26, 2011 5:32 PM (in response to dwagmuse)Ok, DOH! You're using an expression language call here, and I'm guessing some richfaces bean returns a reference to the client-side element that .hide() can be called on. That only works if you use an inline script -- not if the script is in a separate js file. I think that's my problem.
So I guess my question is whether there is a PURE javascript way to close the popup.
-
4. popupPanel controls javascript syntax?
dwagmuse Apr 26, 2011 6:03 PM (in response to dwagmuse)If I move the function into an inline script the code to hide/show the popup works. However, now there's a different problem.
I want this function to do two things: show the popup, and ajax render its form content. It looks like I can successfully do one or the other, but not both. If I just render the popup form's contents and use a separate button to show() it afterward I can see that it was correctly rendered. And if I comment out the code that causes the ajax call the show() works fine. If I do them together the popup is shown, but the form is empty, and it usually locks up the page in the browser too (firebug produces a <System> error).
I had originally tried attaching a componentControl to the component/event that causes the popup to render and that didn't work either. So, the following code causes the "details" popup to show, but the ajax rendering doesn't happen. It does seem to submit the request, but the form ends up empty.
<h:commandButton id="tocoursedetailsviewsubmit"
style="display:none">
<rich:componentControl event="click" target="details" operation="show" />
<a4j:ajax render="details" execute="tocoursedetailsviewinput" />
</h:commandButton>
-
5. popupPanel controls javascript syntax?
iabughosh Apr 27, 2011 7:32 AM (in response to dwagmuse)try using a4j:commandButton to show popup and use oncomplete event :
<a4j:commandButton value="show"
execute="myInputTxt"
render="outputMsg"
oncomplete="#{rich:component('panel')}.show()">
</a4j:commandButton>
where myInputTxt is an inpuText outside the popup and outputMsg is an outputTxt inside the popup.
-
6. popupPanel controls javascript syntax?
ilya_shaikovsky Apr 27, 2011 9:33 AM (in response to dwagmuse)1 of 1 people found this helpfulat first Ibrahim Abu Ghosh is right and in order to perform both activities you should just send ajax request perform an update and call the hide() or show() in oncomplete.
And in case you need to call js from the exterrnal js file and want to add plain JS here please check the http://community.jboss.org/wiki/RichFacesMigrationGuide33x-4xMigration-CommonComponentsChanges#client_api page. There is the result of rich:component evaluation shown,
-
7. popupPanel controls javascript syntax?
dwagmuse Apr 27, 2011 9:48 AM (in response to dwagmuse)That works!! Thanks!