How do I set value and appearance on mutiple Widgets that share the same field name?

Q: I am using PDFTron version 5.0 to save values to PDF forms. Here,
in this example I am using one PDF file with 5 textboxes with the
same name. This program is entering same value for all that textboxes
but after I save the PDF it is not displaying all the textboxes
values.

Please check attached example which will help to understand the
scenario and let me know if you have any further question.

protected void Page_Load(object sender, EventArgs e)
{
    try
    {
        string myFile = Server.MapPath("SameFieldName.pdf");
        byte[] larr_FileContents = File.ReadAllBytes(myFile);
        int lint_BuffSize = 0;
        PDFNet.Initialize();
        using (PDFDoc pdfDocument = new PDFDoc(larr_FileContents,
larr_FileContents.Length))
        {
            WriteFormDataToPdf("test1", "testtext",
pdfDocument);
            //WriteFormDataToPdf("CheckBox2",true, pdfDocument);
            //WriteFormDataToPdf("CheckBox3",true, pdfDocument);
            larr_FileContents = null;
            pdfDocument.Save("C:\\Temp\\apptest" +
Guid.NewGuid().ToString() + ".pdf",
SDFDoc.SaveOptions.e_remove_unused);
            pdfDocument.Save(ref larr_FileContents, ref lint_BuffSize,
SDFDoc.SaveOptions.e_remove_unused);
            Response.Write("sucess");
        }
    }
    catch
    {
        Response.Write("Failure");
    }
}

private bool WriteFormDataToPdf(string fieldName, string fieldValue,
PDFDoc pdfDocument)
{
    try
    {
        // Set field value in pdf
        FieldIterator fieldIterator =
pdfDocument.GetFieldIterator(fieldName);
        Field currentField = fieldIterator.Current();

        if (currentField != null) {
            currentField.SetValue(fieldValue);
            currentField.SetFlag(pdftron.PDF.Field.Flag.e_read_only,
true);
            currentField.RefreshAppearance();
            return true;
        }
    }
    catch {
        throw new Exception("Unable set value '" + fieldValue + "' for
the field '" + fieldName + "'");
    }
    return false;
}
----------------------
A: Because you have multiple widgets with the same name you need to
iterate over all Widgets, otherwise you will refresh the appearance
only on a first widget in the group. For example:

private bool WriteFormDataToPdf(string fieldName, string fieldValue,
PDFDoc pdfDocument)
{
    try
    {
    FieldIterator fieldIterator =
pdfDocument.GetFieldIterator(fieldName);
    while (fieldIterator.HasNext()) {
      Field currentField = fieldIterator.Current();
      if (currentField.GetName() != fieldName) {
        return true;
      }
      currentField.SetValue(fieldValue);
      currentField.SetFlag(pdftron.PDF.Field.Flag.e_read_only, true);
      currentField.RefreshAppearance();
      fieldIterator.Next();
    }
    return true;
    }
    catch {
        throw new Exception("Unable set value '" + fieldValue + "' for
the field '" + fieldName + "'");
    }
    return false;
}