PDA

View Full Version : Regular Expression for if = -1 on select list


andy.schofield283961
02-20-2010, 10:47 AM
I am trying to trigger a validation if a select list has a value of -1. I have used the validation toolkit to drive another function with the 'required / not blank / selection made' which works great. But I want to check on page submit for invalid selection of the select list.

Cant figure out how to add an expression which list characters NOT allowed.

Any help would be welcomed.

Dani Chankhour
02-22-2010, 11:21 AM
Here is a simple example:

<form id="form1" name="form1" method="post" action="" onsubmit="
if(document.getElementById('select').options[document.getElementById('select').selectedIndex].value == -1) alert('test');">


You will just need to update 'select' with your select id.