1. Hugh (cheesegrits) here. Thank you for all the good wishes. My back surgery was a success, post-op recovery is going well, and I'm getting stronger and feeling better every day. I hope to be getting back in the saddle and working support again over the next few days.
  2. IMPORTANT NOTE - we have made some changes in our github branch naming. The 'master' branch no longer exists, and is now called 'joomla25' (which is Fabrik 3.0). The 'joomla3' branch (which is Fabrik 3.2) remains unchanged. We have also removed all the other testing branches which had accuulated over the last few years. I have posted a thread in the Community forum for 3.0 with some more information, feel free to as questions there.

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