Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Validate phone and email in Multiple short text

  • IngeborgNor
  • IngeborgNor's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 9 months ago #155961 by IngeborgNor
I can't get this to work: manual.limesurvey.org/QS:Em_validation_q/en

Maybe I have a typo or something. Do anyone have a sample of the example in the manual?
The topic has been locked.
  • IngeborgNor
  • IngeborgNor's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 8 months ago #156152 by IngeborgNor
Replied by IngeborgNor on topic Validate phone and email in Multiple short text
Got it!
In Question validation equation:
Code:
(is_empty(kontaktinfoDin_SQ004) or regexMatch('/^(\w[-._+\w]*\w@\w[-._\w]*\w\.\w{2,3})$/',kontaktinfoDin_SQ004)) and 
(is_empty(kontaktinfoDin_SQ005) or regexMatch('/^[\(\)\.\- ]{0,}[0-9]{2}[\(\)\.\- ]{0,}[0-9]{2}[\(\)\.\- ]{0,}[0-9]{2}[\(\)\.\- ]{0,}[0-9]{2}[\(\)\.\- ]{0,}$/',kontaktinfoDin_SQ005))

In Question validation tip (nb):
Code:
{if(regexMatch('/^(\w[-._+\w]*\w@\w[-._\w]*\w\.\w{2,3})$/',kontaktinfoDin_SQ004),'Takk, eposten ser riktig ut <br />','Skriv inn en riktig epostadresse.<br />')}{if(regexMatch('/^[\(\)\.\- ]{0,}[0-9]{2}[\(\)\.\- ]{0,}[0-9]{2}[\(\)\.\- ]{0,}[0-9]{2}[\(\)\.\- ]{0,}[0-9]{2}[\(\)\.\- ]{0,}$/',kontaktinfoDin_SQ005),'Takk, telefon ser riktig ut','Skriv inn en riktig telefon, åtte siffer.')}

I still have no idea how to use the Sub-question validation equation
The topic has been locked.
  • IngeborgNor
  • IngeborgNor's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
6 years 8 months ago #156189 by IngeborgNor
Replied by IngeborgNor on topic Validate phone and email in Multiple short text
I've made an example, see attached group:

File Attachment:

File Name: kontaktinfo.lsg
File Size:6 KB


Question validation equation:
Code:
(is_empty(kontaktinfo_epost) or regexMatch('/^(\w[-._+\w]*\w@\w[-._\w]*\w\.\w{2,3})$/',kontaktinfo_epost)) and 
(is_empty(kontaktinfo_tlf) or regexMatch('/^[\(\)\.\- ]{0,}[0-9]{2}[\(\)\.\- ]{0,}[0-9]{2}[\(\)\.\- ]{0,}[0-9]{2}[\(\)\.\- ]{0,}[0-9]{2}[\(\)\.\- ]{0,}$/',kontaktinfo_tlf))

Question validation tip (nb):
Code:
{if(regexMatch('/^(\w[-._+\w]*\w@\w[-._\w]*\w\.\w{2,3})$/',kontaktinfo_epost),'Takk, eposten ser riktig ut <br />','Skriv inn en riktig epostadresse.<br />')}
{if(regexMatch('/^[\(\)\.\- ]{0,}[0-9]{2}[\(\)\.\- ]{0,}[0-9]{2}[\(\)\.\- ]{0,}[0-9]{2}[\(\)\.\- ]{0,}[0-9]{2}[\(\)\.\- ]{0,}$/',kontaktinfo_tlf),'Takk, telefon ser riktig ut','Skriv inn et riktig telefonnummer, åtte siffer.')}

And I think that the Sub-question validation equation is only useful if all the subquestions have the same criteria, etc. all should be email-addresses.
Attachments:
The following user(s) said Thank You: tpartner
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose