Back Forum Reply New

calling client javascript from webflow

hiii all,
is there a way i can call a client side javascript from webflow? i mean from any of the bean methods used in webflow can i call/invoke a javascript method or expression on client end?
  i searched a lot on internet for this, but couldn't find relevant sources. i am very much in need of such solution. any one who are known of this or similar solution please help me.

Thank You.

Maybe you could explain what you are trying to do exactly. Then I'm sure we can rephrase your problem in terms of client-gt;server communication as opposed to server-gt;client

hiii Osvaldas Grigas,
i appreciate your concern. well i am working on Richfaces as view layer components and spring webflow. so when user clicks on a button/link , a subflow is initiated in webflow. so a component called modalPanel is invoked on user end and all the contents and actions of this modalPanel are to be interacting with this subflow.  i can invoke this component on front end by javascript using javascript:Richfaces.showModalPanel('wizard') .on button/link click. but its not getting synchronized with subflow. so i thought if i can invoke this JS of modalPanel from server end it might be working as part of subflow and interacting with it. I am not sure this approach is right or not... but i thought it might work that way... even if some other right approach is possible please share with me.. i hope u got what i am trying to do.. and sorry if u don't . i would be very much willing to try again if u dnt get it... pls make ur suggestions.

Thank you.

and if u can please have a look, my previous threads

Opening Richfaces modalPanel upon subflow start

Open Sub Flow In a Modal Panel

in Spring Web Flow might give you a better idea of what i am trying to do.

let me knw if this feature is possible with what is available or not. because i am working on to get this thing done from last 4 days.

pls reply

Thank You.

You could try this. Instead of calling Richfaces.showModalPanel('wizard'), invoke a JSF action that would trigger a WebFlow transition to quot;wizardquot; subflow. The subflow should contain a view-state for each wizard page, and these view-states should display their results in a quot;popupquot; rather than a new page. Something like this:Code:
lt;view-state id=quot;wizardPage1quot; popup=quot;truequot;gt;   lt;transition on=quot;nextquot; to=quot;wizardPage2quot;/gt;
lt;/view-stategt;

lt;view-state id=quot;wizardPage2quot; popup=quot;truequot;gt;   lt;transition on=quot;nextquot; to=quot;wizardPage3quot;/gt;
lt;/view-stategt;

...
Disclaimer: haven't tried this myself.

well i tried that, and pop is not working. its opening the viewpage in same window. and if i am not wrong , in the code you posted , there is no content thats is displayed in view-state right? i mean there is no view=quot;abc.xhtmlquot; something like this. so how can a event for transition can be raised from that view.   i made a subflow like this...

lt;view-state id=quot;startquot; view=quot;/Pages/userInfo/userProfile.xhtmlquot; popup=quot;truequot;gt;
lt;on-entrygt;

lt;/on-entrygt;
lt;transition on=quot;closeImageWizardquot; to=quot;closequot; /gt;
lt;/view-stategt;

lt;end-state id=quot;closequot;gt;

lt;/end-stategt;

but even this is not opening popup, but opening my view page in same window.

i am using firefox 3.6 and ubuntu OS. so is there any reason why popup doesn't comes up?

In Spring Web Flow 2.0, view names follow the convention of view state ID if not explicitly specified, so I just skipped them for the sake of brevity.

The popup=quot;truequot; part should work if you include Spring JavaScript library in your HTML pages. Of course, this library is based on Dojo toolkit, so the popup will have a different look than lt;rich:modalPanelgt; (which is, I'm guessing, based on jQuery).

If you want to use lt;rich:modalPanelgt;, there may be another option: open the modal panel that contains an lt;iframe id=quot;wizardFramequot;/gt;, and set the iframe source to ucl that is handled by your wizard flow, e.g.

Richfaces.showModalPanel('wizard'); jQuery('#wizardFrame').attr('src', '/my-app/wizard');

In that case you can skip the popup=quot;truequot; part because all the wizard flow output will already be contained within the iframe. I know this is kind of old-school and not very elegant, but hey, it may work.

hey its ok even with spring javascript library. but i am using facelets so my pages are of .xhtml extension. so with this can u please suggest any sources/refrences on how to use this spring JS library in .xhtml?Thank you.

Read this:
Serving JavaScript resources
Configuring web.xml
Handling JSF events -gt; see sub-section quot;Handling Ajax Eventsquot;
¥
Back Forum Reply New