Duplicate data - InfoPath Dev
in

InfoPath Dev

Duplicate data

Last post 02-28-2011 07:31 AM by arif@HP. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 02-25-2011 05:51 AM

    Duplicate data

    I am working with a form that has 19 text boxes that are set to whole number entry only. I need a way to validate that the user has entered a number in those boxes but has not duplicated that number. So I cant have more than one "1" in the boxes but all boxes can have a 1 placed anywhere in them. The user must use all 19 numbers in their data entry. Been looking around here and google and have come up with no viable solution. The count() function and preceding-sibiling and following-sibiling rules just dont seem to be working correctly. Anyone have ideas. Thanks in advance.

  • 02-28-2011 06:08 AM In reply to

    Hi,

    Do you want your textbox to detect a duplicate number as soon as the user enters it? Or are you validating the whole text box after the user has finished inputting their numbers?

    Regards,

  • 02-28-2011 06:46 AM In reply to

    Either or. Just as long as that after the user enters the number and they move onto the next field that it would alert them that its a double number and that they cannot submit the form if they do not change the double number.

  • 02-28-2011 07:31 AM In reply to

    Ok then. Well there are only 10 numbers available to pick from (0 - 9)
    Perhaps make a loop which scans each number, from each field before the form submits. 
    You can do this by splitting each character as its own string in an array, then checking it against the previous number(s).
    When creating your loop, use the CancelableArgs event in an if statement to decide if your form submits your data or not.
         if (numbers are repeated....) MessageBox.Show("Please ensure each field does not contain duplicate numbers.");
          e.CancelableArgs.Cancel = true;
       else
          e.CancelableArgs.Message = "Submit succeeded.";
    
Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.