Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: calling client javascript from webflow

  1. #1
    Join Date
    Sep 2010
    Posts
    19

    Default 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.

  2. #2
    Join Date
    Sep 2009
    Location
    Vilnius, Lithuania
    Posts
    118

    Default

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

  3. #3
    Join Date
    Sep 2010
    Posts
    19

    Default

    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.

  4. #4
    Join Date
    Sep 2010
    Posts
    19

    Default

    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.

  5. #5
    Join Date
    Sep 2009
    Location
    Vilnius, Lithuania
    Posts
    118

    Default

    You could try this. Instead of calling Richfaces.showModalPanel('wizard'), invoke a JSF action that would trigger a WebFlow transition to "wizard" subflow. The subflow should contain a view-state for each wizard page, and these view-states should display their results in a "popup" rather than a new page. Something like this:

    Code:
    <view-state id="wizardPage1" popup="true">
        <transition on="next" to="wizardPage2"/>
    </view-state>
    
    <view-state id="wizardPage2" popup="true">
        <transition on="next" to="wizardPage3"/>
    </view-state>
    
    ...
    Disclaimer: haven't tried this myself.

  6. #6
    Join Date
    Sep 2010
    Posts
    19

    Default

    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="abc.xhtml" something like this. so how can a event for transition can be raised from that view. i made a subflow like this...

    <view-state id="start" view="/Pages/userInfo/userProfile.xhtml" popup="true">
    <on-entry>

    </on-entry>
    <transition on="closeImageWizard" to="close" />
    </view-state>

    <end-state id="close">

    </end-state>

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

  7. #7
    Join Date
    Sep 2010
    Posts
    19

    Default

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

  8. #8
    Join Date
    Sep 2009
    Location
    Vilnius, Lithuania
    Posts
    118

    Default

    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="true" 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 <rich:modalPanel> (which is, I'm guessing, based on jQuery).

    If you want to use <rich:modalPanel>, there may be another option: open the modal panel that contains an <iframe id="wizardFrame"/>, and set the iframe source to URL 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="true" 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.

  9. #9
    Join Date
    Sep 2010
    Posts
    19

    Default

    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.

  10. #10
    Join Date
    Sep 2009
    Location
    Vilnius, Lithuania
    Posts
    118

    Default

    Read this:


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •