pop up message when selecting a specific item from the list collector

sonita
Giga Guru

I have a list collector , when selecting a specific item , a pop up message should be shown . I have an on-change client script to meet this requirement:

function onChange(control, oldValue, newValue, isLoading) {

    if (isLoading || newValue == '') {

          return;

    }

  if(newValue=="8444356d6fc00200512f5e354b3ee426")

{

  alert('MY MESSAGE');

   

}

   

}

this code works , but the problem is when selecting other items , this message will pop up again! I need the pop up to happen only once! and when that specific item is selected!

14 REPLIES 14

Hi Abhinay E,


Actually this is what I did and it works , BUT i wanna use alert so what can I write instead of :g_form.hideFieldMsg('applications', true);




function onChange(control, oldValue, newValue, isLoading) {


    if (isLoading || newValue == '') {


          return;


    }




  var text='ECS Access Required for this application.Select "ECS" from collection if you currently do not have ECS Access';



  g_form.hideFieldMsg('applications', true);




  if(newValue=="8444356d6fc00200512f5e354b3ee426")//OCWA-OSCAR Claims Web Application



  {


g_form.showFieldMsg('applications',text,'info'); /// this is instead of alert



  }  


Soni,



    you can add alert here, but it only works, if you only select "OCWA-OSCAR Claims Web Application" to the right bucket. Moreover you will get the alert when you touch any other values on the left bucket.




Thanks,


Abhinay


That's right , and the alert message is asking to select another item too, so when they want to select the 2nd item , it again pops up! but it shouldn't


Soni,



  I will recommend you to write an onSubmit and display alert and stop the user from ordering the item, if he did not select the other item. What is the sys_id of the other item you want user to select?



Thanks,


Abhinay


Hi Abhinay E,


actually I decided to use Macro instead of pop up box , and thta works fine , and the business approved it. thanks for your help again.



function onChange(control, oldValue, newValue, isLoading) {


    /*if (isLoading || newValue == '') {


          return;


    }*/



  var text='ECS Access Required for this application.Select "ECS" from collection if you currently do not have ECS Access';




  g_form.setDisplay('macro_alert', false);




  if(newValue.toString().indexOf("8444356d6fc00200512f5e354b3ee426")>-1)//OCWA-OSCAR Claims Web Application



  {



  g_form.setDisplay('macro_alert', true);


  }



  else if((newValue!="8444356d6fc00200512f5e354b3ee426") )


  {



  g_form.setDisplay('macro_alert', false);



  }






}