Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

combo box validation

Status
Not open for further replies.

lucyc

Programmer
Mar 1, 2002
62
US
There are 2 section on my page. I have a combo box on each section. Use need to select at least one option from section 1 or section 2. I have the following code to validate the data, I use msgbox to display the value of the two combo box and I get no value in these two boxes.

Here is my code:
Function ValidateOK(myvalue1, myvalue2, mycontrol,myMessage)

set myform=document.forms("MRready")
strCSBBarriers=Document.getElementById("CSB1").Value
strOthBarriers=Document.getElementById("OTH1").Value

If ValidateBarriers(strCSBBarriers, strOthBarriers, Document.getElementById("CSB1"),"Barriers")=True then ValidateOK=True
else
ValidateOK=False
End If

End Function

The following is the ValidateBarrier function:

Function ValidateBarriers(myvalue1,myvalue2,mycontrol,myMessage)
'If Left(myvalue1,6)="select" and Left(myvalue2,6)="select" then
'ValidateBarriers=False
'Msgbox "You must select at least one barrier from A or B.",,myMessage
'mycontrol.Focus

'Else
'ValidateBarriers=True
'End If
msgbox "value 1: " & myvalue1
msgbox "value 2: " & myvalue2
msgbox "myMessage : " & mymessage
ValidateBarriers=false
End Function

Thanks in advance.
 
Hiya,

Step-by-step.

Does strCSBBarriers and or strOthBarriers actually contain expected data? Msgbox 'em straight after they've been assigned values.

Have you checked that the arguments actually pass values to the ValidateOK function?

i.e. msgbox both myvalue1 and myvalue2 in the ValidateOK function immediately on entry.

Do they contain values as expected, and if so is the case correct? (Lower case 'select' as opposed to 'SELECT' or 'Select')?

Is the logic correct in the sense that if both variables have 'select' as their first 6 chars, then ValidateBarriers fails?

Your code looks like you know what you are doing, please don't be offended by this advice.

Regards,

Darrylle "Never argue with an idiot, he'll bring you down to his level - then beat you with experience."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top