Hi all,

I have this code:
VB Code:
  1. Dim sb As New System.Text.StringBuilder
  2.                         'sb.Append("if (typeof(Page_ClientValidate) == 'function') { ")
  3.                         'sb.Append("if (Page_ClientValidate() == false) { return false; }} ")
  4.                         sb.Append("var answer = confirm('Update client?'); ")
  5.                         sb.Append("if (answer) { ")
  6.                         sb.Append(Me.Page.GetPostBackEventReference(Me.btnCopyAddress))
  7.                         sb.Append("; ")
  8.  
  9.                         For i = 1 To collClient.Count
  10.                             sStr = CType(collClient(i), ClientFields)
  11.                             If Left(sStr.sField, 1) = "s" Then
  12.                                 sb.Append("document.forms(0)." & sStr.sField & ".value = """ & sStr.sValue & """;")
  13.                             End If
  14.                         Next i
  15.  
  16.                         sb.Append("}")
  17.                         'sb.Append("this.image=""images\editbutton.jpg""; }")
  18.                         sb.Append(" else {")
  19.                         sb.Append(" return false; }")
  20.                         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...