views:

16

answers:

1

I have a dropdown which displays some programs (active and inactive). I have a column (isActive) in the programs table in the database which either has a value N or Y.

Now I want to filter the dropdown to display only active programs. So, I will just do a sql select to get all programs which are active. Everything is fine up to here.

Now if a user tries to access his record and the program which this user selected (sometime earlier) is no longer active now, the dropdown will now show the first value.

What is a possible solution for this issue? How can I only show active programs in the dropdown without messing up with users record?

A: 

Make your first option in the select be a blank value. That way it will default blank if no value is present in the dropdown to select. Then, just validate your form so you don't get a blank value.

Jage
That's Ok but how will I show this user the value he selected in the record. It's like let say user wants to see his record which could like 1 year old, and when he opens this record he will know not be able to see the value which he selected.