IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Issue while using custom java script on async command button

    Posted Mon January 24, 2011 06:12 PM

    Hi
    We have a requirement to add java script validations on various check boxes provided on task view form.We are trying to achieve this by adding it on Click(Java script on click event handler) available on Client-Side Events tab of async command button but custom java script does not work.Can you provide us some samples or guidelines to understand whats the issue.


    #webMethods
    #webMethods-BPMS
    #MWS-CAF-Task-Engine


  • 2.  RE: Issue while using custom java script on async command button

    Posted Tue January 25, 2011 08:23 AM

    Hi
    could you provide some more details about what is not working? Or about what you’re doing in your js and what you expect it to do?
    When you say validation on check boxes, I suppose you only want to check if they are checked or not, right?

    best regards,
    Javier


    #webMethods
    #webMethods-BPMS
    #MWS-CAF-Task-Engine


  • 3.  RE: Issue while using custom java script on async command button

    Posted Tue January 25, 2011 09:25 AM

    Hi Javier
    Thanks for your reply.Yes i want to ensure if mandatory checkboxes have been checked when submit button has been clicked .Apart from this there are a few text boxes also which are mandatory and i want to add a custom java script to the async command button so that validations are done when submit button is clicked by user.


    #webMethods-BPMS
    #MWS-CAF-Task-Engine
    #webMethods


  • 4.  RE: Issue while using custom java script on async command button

    Posted Tue January 25, 2011 12:14 PM

    Hi
    you have different options…

    • + Use the “required” flag
      + Evaluate check boxes and input fields value in the action called by the Async Command
      + Evaluate those fields in the Client-Side events

    Have a look into the samples[url]http://communities.softwareag.com/ecosystem/communities/public/Developer/webmethods/tutorials/CAF/CAFSamples_80_Doc/Webm_caf_samples_80_index.html[/url] and the documentation for the JavaScript API [url]http://techcommunity.softwareag.com/ecosystem/documentation/webmethods/wmsuites/wmsuite8_ga/My_webMethods_and_Task_Engine/8-0-SP1_CAF_JavaScript_Reference/index.html[/url]
    A sample JS could be (for v8.0.x):

    var myCheckbox = CAF.model('#{caf:cid('my-checkbox-id')}');
    if (myCheckbox.getValue()) {
    alert("checkbox is checked");
    }

    best regards,
    Javier


    #MWS-CAF-Task-Engine
    #webMethods
    #webMethods-BPMS


  • 5.  RE: Issue while using custom java script on async command button

    Posted Tue January 25, 2011 09:14 PM

    Hi Javier
    Thanks for your response.It works fine for me after modifying it as per my needs .It prompts me with an alert to fill mandatory fields but issue is once i click on OK on validation alert on web page task gets submitted instead action should not be executed unless mandatory fields have been filled by user.
    Script used is on client side events under click.

    Regards
    Anuj


    #webMethods-BPMS
    #MWS-CAF-Task-Engine
    #webMethods


  • 6.  RE: Issue while using custom java script on async command button

    Posted Wed January 26, 2011 03:36 PM

    well, then you could do the validation in the java action (in my opinion, the simplest and easiest to maintain solution).
    In case you want to stay with the javascript, you could add an async hidden command to perform the server side action and raise it if all your javascript checks pass. That way you’ll have a button to get the click and evaluate your checkboxes and a second button to call the action if all is ok.

    best regards,
    Javier


    #webMethods
    #webMethods-BPMS
    #MWS-CAF-Task-Engine


  • 7.  RE: Issue while using custom java script on async command button

    Posted Wed January 26, 2011 05:54 PM

    if you want the onclick javascript code to stop the processing of the click, you can just use a return statement like this:

    return false;

    #webMethods
    #webMethods-BPMS
    #MWS-CAF-Task-Engine


  • 8.  RE: Issue while using custom java script on async command button

    Posted Fri January 28, 2011 05:31 AM

    Hi Eric and Javier
    Thanks for all your responses.Issue is resolved now.

    Regards
    Anuj


    #webMethods-BPMS
    #webMethods
    #MWS-CAF-Task-Engine