Popup on drop down selection SharePoint 2007 WSS3

38 views Asked by At

I have a field (titled; Absence Type) in a holiday booking form with the following options;

Holiday
Authorised Absence
Flex

When 'Holiday' is selected from the list I wish to display the following message; "Holidays must be pre-approved in PS"

I'm assuming that this should be possible using a CEWP (in 2007) on the NEW/EDIT form for the list. I have been through all the other solutions and spent a good amount of time searching Google but I haven't been able to get it working.

Thanks in advance

1

There are 1 answers

0
vinay yadav On BEST ANSWER

You are right that I can be done with CEWP, if you want the feature to be in both New/Edit form then add the webpart in both the form. In the web part add the following code

The list where you are selecting the options should be a tag ,ex

<select id="mySelect">
 <option value="Holiday">Holiday
 <option value="Authorised Absence">Authorised Absence
 <option value="Flex">Flex
</select>

the above part you will find in the New/Edit form.

What you have to do in the CEWP is

<script>
/// selecting that particular tag will the main task here, you can grab 
    it 
//by the id like below , or you can grab it by the class name and find 
//the exact tag where the options will be selected


var selecttag= document.getElementById("mySelect");

selecttag.onchange = function(e){
  if(e.target.value == "Holiday"){
  alert("Holidays must be pre-approved in PS");
}
}
</script> 

Hope this helps