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

Just tweaked the script a little bit Here is your updated client script:



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


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


          return;


    }


if((newValue.toString().indexOf("8444356d6fc00200512f5e354b3ee426")>-1) &&(oldValue.toString().indexOf("8444356d6fc00200512f5e354b3ee426")==-1)){


  alert('your message');


}


}



Thanks,


Abhinay



PS: Hit like, Helpful or Correct depending on the impact of the response


when I changed the script to this , actually by selecting every item , after selecting that specific item , it shows the pop up message


You might have to write an onsubmit client script for this. Some how oldValue id not pulling any values in onChange client script.



Thanks,


Abhinay



PS: Hit like, Helpful or Correct depending on the impact of the response


Thank you so much ! I'll try that


Your onSubmit script will be:


if(g_form.getValue('your list collector variable name').toString().indexOf('8444356d6fc00200512f5e354b3ee426')>-1){


alert("your message");


}