how to call javascript function that takes parameter and returns value???

  1. #1

    how to call javascript function that takes parameter and returns value???

    Hi,
    In coolite if i want to add a click handler in a button control i have to add a listener for that.

    Now from example i have got an idea how to call a javascript function in coolite controls.

    Now my question is that,
    How can i call a javascript function that returns a value and the function also takes parameters.

    The function like below,
    funciton myFunction(obj)
    {
    // some checking
    return true/false
    }

    Plz help me out ...kind of urgent...
  2. #2

    RE: how to call javascript function that takes parameter and returns value???

    Hi,

    Yes. Use a Handler to pass in the information you want and it can also return data. However, your return I don't believe is hooked up to the element like the Fn call is. So you might want to pass the element #{Element} itself to the Handler and then invoke the desired action. ~ #{Element}.stopEvents();


    Here is what i found helpful working in Coolite/ExtJS rolling my own Javascript functions.


    1) Use Firebug/Firefox
    2) For each page, create a Javascript Namesake and perform any operation more then a 1 liner in this script. Then use Firebug to debug that script isolated from your page scripts and the larger ExtJS and Coolite scripts.
    3) Use the #{Componenet} to pass in references to the objects that any method is going to be operating on
    4) 'Fn' tend to pass in all the information based on the event and the source of the event, see ExtJS documentation and use Firebug to inspect parameters to see more. They have their own parameter set.
    5) 'Handlers' are useful when you can access the values you are interested on an event and would like to control what data enters the method. You create the function signature.
    6) Use this.Element.ScriptManager.AddScript( ... ) to invoke and create clientside actions from your code-behind.




    <TriggerClick  Handler="TiggerHandler(#{GridPanel1}, #{TextFieldSearch}.getValue(),#{TextAreaShowUPdate}); " /> </Listeners>





Similar Threads

  1. Call JavaScript function with CellSelection
    By bolzi89 in forum 1.x Help
    Replies: 5
    Last Post: Dec 23, 2011, 2:42 PM
  2. Replies: 8
    Last Post: Dec 23, 2011, 12:41 PM
  3. How to call the javascript function form code behind
    By harshad.jadhav in forum 1.x Help
    Replies: 3
    Last Post: Mar 29, 2011, 3:00 PM
  4. [CLOSED] Call Javascript Function
    By speedstepmem4 in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jul 21, 2010, 3:58 AM
  5. [CLOSED] How to call a javascript function from a child page?
    By flormariafr in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Mar 25, 2010, 5:40 PM

Posting Permissions