|
-
Nov 29th, 2006, 08:23 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] JavaScript + Required fields validators
Hi all,
I have this code:
VB Code:
Dim sb As New System.Text.StringBuilder
'sb.Append("if (typeof(Page_ClientValidate) == 'function') { ")
'sb.Append("if (Page_ClientValidate() == false) { return false; }} ")
sb.Append("var answer = confirm('Update client?'); ")
sb.Append("if (answer) { ")
sb.Append(Me.Page.GetPostBackEventReference(Me.btnCopyAddress))
sb.Append("; ")
For i = 1 To collClient.Count
sStr = CType(collClient(i), ClientFields)
If Left(sStr.sField, 1) = "s" Then
sb.Append("document.forms(0)." & sStr.sField & ".value = """ & sStr.sValue & """;")
End If
Next i
sb.Append("}")
'sb.Append("this.image=""images\editbutton.jpg""; }")
sb.Append(" else {")
sb.Append(" return false; }")
btnCopyAddress.Attributes.Add("onclick", sb.ToString())
This code works when all required fields are filled. If not, the code won't change any of the fields, could there be a reason why?
I make it stranger: this code works when all required fields are filled, EXCEPT the fields that are filled through this code... Thus, if the required fields that are changed by this code are not filled, and all other required fields are, it works. But, if one field that is required and NOT changed by this code is not filled, the whole code doesn't work...
Is there anyone who could tell me how to work around the required fields? Thanx in advance...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|