1. Hugh is now back at work, more or less full time, after a slower than expected recovery from his neck surgery early this month. Obviously we have a backlog of support to clear, and are working as hard as we can to take care of it. If you have an unanswered thread more than 3 days old, please post one (and only one) "bump" on it, to move it in to our "last 3 days" list. If you have an unanswered issue in a forum you no longer have access to due to subscriptions timing out, please use the Contact Us form, and provide us with the URL to the thread.

validation is empty or is unique value

Discussion in 'Community Support' started by ErnstJan, Jan 24, 2012.

  1. ErnstJan Member

    Level: Community
    Hello,

    In a form I have a field element in which they have to put a number, example 213456789, or if they don't have a number, this field stays empty. This number is a unique value. Is it possible to have combined these two validations (is unique value or is empty). If possible how to achieve this?
    Just let me know.

    Kind regards, Ernst
  2. troester Well-Known Member

    Level: Standard
    In the isunique validation set the condition:
    return '{your-table___element}'!='';
    So it's only validating if the element is not empty.
  3. ErnstJan Member

    Level: Community
    validating is unique value or is empty

    Thanks Troester,

    Works perfect! Last question: is it possible to say this unique value only has nine numbers example: 012345678 or 993456782 (without any other character like , :?# etc) ?
    Just let me know.

    Kind regards, Ernst
  4. troester Well-Known Member

    Level: Standard
    You can add a regular expression validation (there have been some threads about validating telephon numbers).
  5. ErnstJan Member

    Level: Community
    validating is unique value or is empty and regular expression

    Hello Troester,

    Thanks for very quick reply! I found this regular expression and changed it a little:
    /^[0-9]{9}$/ I also added condition if field is left empty. Everything works fine now!
    I appreciate your help very much!


    Kind regards, Ernst

Share This Page