How to call UI script in client script

sunnysunny
Kilo Contributor

I created a simple ui script, as mentioned below. How can I call this from client script?

function displaytitle()

{

  var a= g_form.getValue('number');

  var b= g_form.getValue('short_description');

  if(a && b)

{

  top.document.title= a +'-'+ b;

}

  else

  {

  alert('hello');

  }

}

15 REPLIES 15

sunnysunny
Kilo Contributor

So this is the client script I wrote


function onSubmit() {


    var ab= new display_title();//name of the ui script


  ab.displaytitle();



}



But its giving error


manojkandimalla
Giga Contributor

You can directly call with function name in client script


For Example:


function onLoad(){


displaytitle(); //Calling ui script function


}




Thanks!


sunnysunny
Kilo Contributor

This is my UI script


function displaytitle()


{



  var a= g_form.getValue('number');


  var b= g_form.getValue('short_description');


  if(a && b)


{


  top.document.title= a +'-'+ b;


}


  else


  {


  alert('hello');


  }



}



and as suggested I made these changes in client script


function onSubmit() {


   


  displaytitle();



}



and it doenot do anything


Hi Sunny,



I have checked with the same script in my system and it is working fine for me


1. UI script must be made Global (Global check box must be checked true).


2. After that we can call the ui script by the function name.



Thanks!



NOTE : UI Script must be GLOBAL


Can you share Screenshots of both the scripts from the top which should include all the variables on the form like name of the script table