I'm getting values from my database for different exam types. Here are some sample values:
Here is how I get the values in vbscript:
<% 'Query to print out available exam types for the user to see
set my_rs = server.createObject("ADODB.recordset")
my_rs.open my_sql, my_conn
existingExamCat = ""
if not(my_rs.bof and my_rs.eof) then
do while not (my_rs.eof)
response.write my_rs.fields("examTypeCat") & "<br>"
existingExamCat = existingExamCat & my_rs.fields("examTypeCat") & ","
response.write "There are no available exam types at this time."
response.write "<br><br>" & existingExamCat
set my_conn = nothing
set my_rs = nothing
The above vbscript works fine and gives me the correct results.
I set up another variable called existingExamCat to keep track of all the exam categories in a comma-delimited list. This is at the bottom of my page.
var existingExamCat = "<%= existingExamCat %>";
Then at the top as part of an onClick event, I have this:
function validateUniqueType ()
var newType = document.formAddExamType.exam_newType.value;
I want to see if the variable "newType", which is entered by the user in a text input box exists in the list of already populated exam names.
So existingExamCat = "Exam Type1,Exam Type2,Exam Type3,"
and the variable "newType" is working. I want to compare newType & existingExamCat. I've looked all around online and am getting frustrated. Any help would be appreciated. Thanks!