Element Javascript Regex /./ onload

ontarget

Active Member
Hi I am trying to hide a password field using javascript regex
My current expression is

I have also tried
on load : When element "password" regex "/[a-z]+/", hide element "sch_profiles.password"
and
/^[0-9A-Za-z]+$/
and
None of these expressions work and my element sch_profiles.password is still showing!!!
If i try another expression e.g
>=0 and the password is e.g 123456 then the sch_profiles.password does hide so it seems my regex expression is not working
Any pointers would be very gladly received!
 
Ah, I see the problem. We put // around what you enter, so putting // around your regex breaks it.

I've tweaked the code to look for them, and only wrap your regex in them if they aren't there. That way you can use modifiers like /foo/i.

I also found a tricky issue with backslashes which I still haven't managed to sort out, so atm you can use stuff like \s or \d, etc.

Anyway ... quick fix, remove the //s/. Update from github to get the code which will optionally allow them.

-- hugh
 
If you just strip the / off the start and end you can do it without updating.

So if all you want to test for is "not empty", I think a "not regex" of .+ would do it.

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top