Welcome to the LimeSurvey Community Forum

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

Make the validation text disappear if the regex validation text is valid

  • p240901
  • p240901's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 8 months ago - 5 years 8 months ago #171621 by p240901
I'm new to customizing themes in LimeSurvey, but thought I'd share a tip.

The default behavior (at least for the bootswatch theme) is to display the regex validation text in red if the entry is invalid, and blue (with same text) if it is valid ie.:
Code:
Please check the format of your answer.

I thought some users might find this a bit confusing: what I wanted is for the invalid regex text to only appear if the text entry was invalid (in this case for an email address). If a regex valid email address was entered, I wanted no message to appear.

To make this happen, in my custom bootswatch theme, I added the following entry to my custom.css file:
Code:
.ls-em-success 
{
  text-indent: 100%;
  white-space: nowrap;
  overflow: hidden;
}

This has the effect of making the validation message disappear when the entry (email) address is valid.

I hope this might help someone, and apologies if there's a more logical or straightforward way to do this!

Pete
Last edit: 5 years 8 months ago by p240901. Reason: chg code tag
The following user(s) said Thank You: Joffm
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 8 months ago - 5 years 8 months ago #171623 by Joffm
Hi, Pete,
thank you for sharing.

This question is asked rather often.
Now there is a thread we can link to answering, instead of writing the same several times.

But please, pay attention to use the correct syntax of your code insertion.
It's better readable if you use "css" for css code, "javascript" for scripts, etc.
Code:
.ls-em-success 
{
  text-indent: 100%;
  white-space: nowrap;
  overflow: hidden;
}

Best regards
Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 5 years 8 months ago by Joffm.
The topic has been locked.
  • p240901
  • p240901's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 8 months ago - 5 years 8 months ago #171659 by p240901
Thankyou Joffm, and sorry I didn't use the CSS code type.

I didn't find the answers to my question before I posted the topic, but acknowledge what I was asking I expected to be a pretty common thing, and my searching was obviously a bit 'sub-optimal'. I'll now go and see how other people solved this issue - as always with .css and HTML there are usually multiple ways to skin the cat as is said in English!
Last edit: 5 years 8 months ago by p240901.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 8 months ago #171660 by DenisChenu
Hi, personnaly i prefer to use em_validation_q manual.limesurvey.org/Question_type_-_Sh...28em_validation_q.29

Then i can set anything for help text.

In 2.6lts template, i directly hide ti for em_regex_validation : gitlab.com/Sondages.Pro/SkeletonQuest/bl...-ui-custom.css#L1256

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose