CFFORM (Flash) Validation with Regular Expressions Not Working

I am having troubles getting regular expression validation to
work in a CFFORM. The below code is an extract of a much larger
form, the first name and last name have a regular expression
validation...and it doesn't work!
I'd appreciate any comments/info for help on this, have
searched high and low on information to get this working...but no
joy.
The code is:
<cffunction name="checkFieldSet" output="false"
returnType="string">
<cfargument name="fields" type="string" required="true"
hint="Fields to search">
<cfargument name="form" type="string" required="true"
hint="Name of the form">
<cfargument name="ascode" type="string" required="true"
hint="Code to fire if all is good.">
<cfset var vcode = "">
<cfset var f = "">
<cfsavecontent variable="vcode">
var ok = true;
var msg = "";
<cfloop index="f" list="#arguments.fields#">
<cfoutput>
if(!mx.validators.Validator.isValid(this,
'#arguments.form#.#f#')) { msg = msg + #f#.errorString + '\n';
ok=false; }
</cfoutput>
</cfloop>
</cfsavecontent>
<cfset vcode = vcode & "if(!ok)
mx.controls.Alert.show(msg,'Validation Error'); ">
<cfset vcode = vcode & "if(ok) #ascode#">
<cfset vcode =
replaceList(vcode,"#chr(10)#,#chr(13)#,#chr(9)#",",,")>
<cfreturn vcode>
</cffunction>
<cfform name="new_form" format="flash" width="600"
height="600" skin="halosilver" action="new_data.cfc">
<cfformgroup type="panel" label="New Form"
style="background-color:##CCCCCC;">
<cfformgroup type="tabnavigator" id="tabs">
<cfformgroup type="page" label="Step 1">
<cfformgroup type="hbox">
<cfformgroup type="panel" label="Requestor Information"
style="headerHeight: 13;">
<cfformgroup type="vbox">
<cfinput type="text" name="reqName" width="300"
label="First Name:" validate="regular_expression" pattern="[^0-9]"
validateat="onblur" required="yes" message="You must supply your
First Name.">
<cfinput type="text" name="reqLname" width="300"
label="Last Name:" validate="regular_expression" pattern="[^0-9]"
validateat="onblur" required="yes" message="You must supply your
Last Name.">
<cfinput type="text" name="reqEmail" width="300"
label="Email:" validate="email" required="yes" message="You must
supply your email or the address given is in the wrong format.">
<cfinput type="text" name="reqPhone" width="300"
label="Phone Extension:" validate="integer" required="yes"
maxlength="4" message="You must supply your phone number.">
</cfformgroup>
</cfformgroup>
</cfformgroup>
<cfformgroup type="horizontal"
style="horizontalAlign:'right';">
<cfinput type="button" width="100" name="cnt_step2"
label="next" value="Next"
onClick="#checkFieldSet("reqName,reqLname,reqEmail,reqPhone","new_form","tabs.selectedInd ex=tabs.selectedIndex+1")#"
align="right">
</cfformgroup>
</cfformgroup>
</cfformgroup>
</cfformgroup>
</cfform>

quote:
Originally posted by:
Luckbox72
The problem is not the Regex. I have tested 3 or 4 different
versions that all work on the many different test sites. The
problem is it that the validation does not seem to work. I have
changed the patter to only allow NA and I can still type anything
into the text box. Is there some issue with useing Regex as your
validation?
Bear in mind that by default validation does not occur until
the user attempts to submit the form. If you are trying to control
the characters that the user can enter into the textbox, as opposed
to validating what they have entered, you will need to provide your
own javascript validation.

Similar Messages

  • Regular expression not working for adobe forms

    Hi,
    Iam using qtp for adobe forms and for some reason if i put in regular expression for apid value it doesn't recognise the object..there is nothing wrong with the regular expression as it is evaluated using regular expression evaluator in qtp 11.0....any ideas
    I got all the addins and everything and when i used regular expression for the top window it works but for any other object it doesn't

    Please try the code and see the problem. The regular expression is fine.
    I can replace the string with these and got results like this:
    import java.util.regex.Pattern;
    public class HtmlFilter implements TextFilter {
        private static String strTagPattern = "<\\s?(.|\n)*?\\s?>";
        private static int patternMode = Pattern.MULTILINE | Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE | Pattern.CANON_EQ;
        private static Pattern tagPattern = Pattern.compile(strTagPattern, patternMode);
        public String filter(String t) {
              if(t==null || t.length()==0) return "";
            String ret = null;
            return tagPattern.matcher(t).replaceAll("");
         public static void main(String[] args) {
              System.out.println(new HtmlFilter().filter(null));
              System.out.println(new HtmlFilter().filter(""));
              System.out.println(new HtmlFilter().filter("<P>abc def</P>"));
              System.out.println(new HtmlFilter().filter("<P>&#25105;&#22269;&#30707;&#27833;&#20379;&#24212;&#23433;&#20840;&#31995;&#32479;&#24433;&#21709;</P>"));
    }The results are
    abc def
    ????????????

  • Password validation with regular expression

    I'm trying to use a regular expression to validate a password. I've tried a number of different regex's that seem to work elsewhere but do not work in HTML DB. This includes a couple that I wrote and that I found on regex web sites. Specifically, I'm trying to validate that a string has:
    1. at least one special character
    2. at least one numeric character
    3. no more than 6 consecutive characters
    4. has a length between 8 and 14
    Does anyone know why some regular expressions do not work in HTML DB that work elsewhere or has anyone done a regex similar to this in HTML DB.
    Thanks!
    - Brian

    I see, I will use the [0-9] instead. The expression still does not work though. I simplified the expression down to try and figure out what doesn't work and it seems like it's the "?=".
    1. I first entered the expression:
    ([:alnum:]*[0-9])
    This expression just says there must be a number and it works fine in HTML DB.
    2. I extended it to:
    ([:alnum:]*[0-9])([:alnum:]*[a-z])
    This expression says that there must be a number followed by a letter. In this example "1a" works but "a1" does not.
    3. To make it not care about the order I would normally add "?=" like so:
    (?=[:alnum:]*[0-9])(?=[:alnum:]*[a-z])
    This should work for "a1" or "1a" because the ? says the order doesn't matter. When I try this in HTML DB neither "1a" or "a1" work.
    Any ideas?
    Thanks
    - Brian

  • Lumia with regular design not working

    Hello, I just signed up this forum cause I have a problem with no solution. Usually, as a good programmer and webdesign, I solve all my problems on my own but am a new developer in Nokia and there is no way out to this problem.
    Said that, I an creating an intranet and it has some small effects with jQuery and nothing else. It uses a lot of Java but all very basic. It was all working fine till yesterday when my clients started complaining that could not login in their Lumia facing a 404 Not Found page.
    The error is really strange cause I can open the website in any computer and any device. But when I also tried to open it on Lumia it shows the same message! The problem is that the Lumia does not even allow the users to login in the intranet cause the main page is not even appearing! It shows the 404 error right when opening the main domain. It's a Lumia only problem cause the website renders very well in any other device I could test so far.
    Has anybody experienced this kind of problem?
    NOTE: I undid all the small updates done in the website in the last 2 days but the problem still persists! I am getting crazy cause clients do not stop complaining. I am telling then to use a normal notebook and it's saving me for a while but it's really sad it does not open in the phone.
    Thank you for any light! Any any any light!
    Solved!
    Go to Solution.

    While the site is not very 'mobile friendly' it loads fine on my L620.. Not sure what the issue may be for others. The only thing not working seems to be the slideshow.
    I'd suggest you take this to the developer support site as you are posting this to a user to user support board now.
    Click on the blue Star Icon below if my advice has helped you or press the 'Accept As Solution' link if I solved your problem..

  • ReplaceAll string by regular expression not work for this case.

    I will delete all tag and want "pure text" but the output is delete all.
    String content = "<aaa>pure text<fff>";
    content = content.replaceAll("<.*>","");Content has output is blank because reqular expression match from begin and end of string
    But when i change
    String content = "<aaa>pure text<fff";
    content = content.replaceAll("<.*>","");The output is ==> pure text<fff
    How make req match in sequential
    Please lead me to solution

    peterdog1234 wrote:
    Thank you very much.
    I know '?' is a Quantifiers.
    I do not understand using ?
    Please lead me againSee the paragraph "Laziness Instead of Greediness" from [http://www.regular-expressions.info/repeat.html].

  • Java validation with regular expression

    Hi
    I need to validate a string such that only numbers, alphabets, -, _, . is allowed and the below mentioned code works fine.
    if( ! l_name.matches("[A-Za-z0-9._-]+" ) ) {
    // do stuff when a valid name is found
    But i need to modify the above regex such that it should also allow space in the name. Any idea how to do that?
    Thanks in advance.

    I tried a space it does not work!!!Then you added the space between a character range or something.
    Here, this is a bit more compact:name.matches("[-.\\w\\s]+")

  • Wireless printing with Airport Express not working

    I set up my Airport Express. I have an HP photojet printer and I can print from my Mac Air but the other 3 windows-based laptops that are connecting to Airport Express can't. Anyone know why that is or how to fix it?

    You did install and run Bonjour for Windows on each PC, correct?
    Does Bonjour "see" the printer...and it won't install....or.....does Bonjour not "see" the printer at all?
    Just in case.....
    Bonjour Print Services for Windows v2.0.2 - Support - Apple

  • Regular expression not working for String.split()?

    hi, i have a String variable called 'table'.
    It has a bunch of chunks of data seperated by whitespace, whether it
    be spaces or carraige returns. Anyways, i want to split this up using
    the String.split function. i want to split it around whitespace.
    here is my code:
    String codes[] = table.split("\s");
    However, i'm getting back all nulls in the codes variable. What am i doing wrong?
    thanks

    split("\\s")\ is special both in Java String literals and in regex, so you need two of them.
    You'll probably also have to take an extra step it you don't want regex to stop at newlines. I forget the details, so check the docs.

  • Java input validation with regular expression

    I am trying to make sure the user can only enter numbers 0 - 100, can any of you Java geniuses give me a hint. My regex matches the inputs I want, but when I enter a '9' I encounter an error when I cast the string to a double. Actually the input value is never assigned to the perc variable, but only when the input is a single digit. Here' s the piece of code that's giving me this headache:
    while(!in.hasNext("[0-9]")){
         try {
              perc = in.next("[0-9]{1,2}|100");
              break;
         } catch (InputMismatchException e) {
              System.out.println("Bad Input - Try Again");
              perc = in.next();
    dblPerc = Double.parseDouble(perc);And here's the error:
    Exception in thread "main" java.lang.NumberFormatException: empty String
            at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:994)
            at java.lang.Double.parseDouble(Double.java:510)
            at applicant_database.View.showInput(View.java:46)
            at applicant_database.View.main(View.java:101)

    Add debugging code to your program to see what you're getting.

  • Configuring the time capsule airport wlan function as "connect to wlan", the time caspule gets a correct IP adress from the other wlans IP range, but does not assign this to the ethernet ports. With Airport Express it worked!

    Configuring the time capsule airport wlan function as "connect to wlan", the time capsule gets a correct IP adress from the other wlans IP range, but does not assign this to the ethernet ports. With Airport express it worked, the single Ethernet port got the IP Parameters passed through!
    My setup is a Vodafon Esaybox connected to ISP. Time Capsule is not able to extend the wlan of the easybox, neither airport express can do.
    Only the option "connect to wlan" is succesful.
    With airport express I was able to connect my Sony Bravia TV to the lan via ethernet to stream pictures, the TV set got an IP adress from the easybox.
    With the time capsule the easybox dosn't find devices connected to the ethernet ports to submit IP adresses. The TV set get another IP adress (169.xxx.x.x.) in subnet mask 255.255.0.0 and I don not now where from.
    My notebook is a MacBook pro.
    Any idea????
    Thank a lot in advance!
    Kind regards
    Ingo

    Neverthe less, could there be the chance, that this feature could be implemnented with an firmware update?
    That would appear to be a question for Apple to answer. You can make suggestions to Apple here:
    Apple - AirPort Extreme - Feedback
    If the AirPort Extreme and Time Capsule are configured to "extend a wireless network" they will provide additional wireless coverage....and...the Ethernet ports are enabled in this type of setup.
    The "catch" here is that you must have an Apple router providing the network to be extended.

  • ADF Email Validation using Regular Expression

    Hi,
    Wanted to add Email Validation VO search.
    It is working if i put
    <af:validateRegExp pattern="[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}"
                                             messageDetailNoMatch="The value {1} is not a valid email address:"/>However this requires email id to be entered in Capital Letters.
    Tried with below option is not working.
                   <af:inputText value="#{bindings.xxEmail.inputValue}" label="Email"
                                          required="#{bindings.xxEmail.hints.mandatory}"
                                          columns="#{bindings.xxEmail.hints.displayWidth}"
                                          maximumLength="#{bindings.xxEmail.hints.precision}"
                                          shortDesc="#{bindings.xxEmail.hints.tooltip}" id="it5">
                                <f:validator binding="#{bindings.xxEmail.validator}"/>
                                <f:validateLength minimum="6"/>             
                                <af:validateRegExp pattern="[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}"
                                             messageDetailNoMatch="The value {1} is not a valid email address:"/>
                            </af:inputText>I got above info from
    ADF Email Validation using Regular Expression
    User don't enter email id Without @ .
    Kindly suggest pattern to achive this.
    Thanks,
    jit
    Edited by: appsjit on Jan 25, 2013 7:08 PM

    The RegEx to check EMail after RFC2822
    [a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?There are still some missing parts in the check as not all suffix combinations are allowed, but this is pretty good.
    Timo

  • Need advice on negating a whole string line with regular expression

    Hi All,
    I am not able to ignore / get rid of the following line even though my Java 6 (Windows XP) String Pattern matching has not taken cater for it:
    *% Cleared: 61%*
    Below is the existing Java String Pattern matching in the simple program:
    Pattern pattern = Pattern.compile("(^.*[A-Z][a-z]*){1,2} \\d{0,4}/?\\d{0,4} ([A-Z][a-z]*){1,2} St|Rd|Av|Sq|Cl|Pl|Cr|Gr|Dr|Hwy|Pde|Wy|La \\d br [h|u|t] \\$\\d+,\\d+|\\$\\d*\\,\\d+,\\d+ ([A-Z][a-z]*){1,}.*$");This pattern is working for valid strings.
    The following pattern has included "^(?!.*\.\.).*$" into the existing one but had no luck still:
    Pattern pattern = Pattern.compile("^(?!.*\.\.).*$|((^.*[A-Z][a-z]*){1,2} \\d{0,4}/?\\d{0,4} ([A-Z][a-z]*){1,2} St|Rd|Av|Sq|Cl|Pl|Cr|Gr|Dr|Hwy|Pde|Wy|La \\d br [h|u|t] \\$\\d+,\\d+|\\$\\d*\\,\\d+,\\d+ ([A-Z][a-z]*){1,}.*$)");This picked up other rubbish including "*% Cleared: 61%*".
    I am looking for a single regular expression that applies to the whole line.
    I am quite new to regular expression but has read through Regular Expressions Cookbook (Oreilly - 2009) and is still not familiar with advance functions such as lookahead / lookbehind...
    Your assistance would be appreciated.
    Thanks,
    Jack

    Hi Winston,
    I am still digesting the material from the regular expression book and will take sometime to become proficient with it.
    It seems that using groupCount() to eliminate the unwanted text does not work in this case, since all the lines returned the same value. Ie 3 posted earlier. This may be because the patterns are complex and only a few were grouped together. Otherwise, could you provide an example using the string posted as opposed to a hyperthetic one. In the meantime, at least one solution have been found by defining an additional special pattern “\\A[^%].*\\Z”, before combining / intersecting both existing and the new special pattern to get the best of both world. Another approach that should also work is to evaluate the size of String.split() and only accept those lines with a minimum number of tokens.
    Anyhow, I have come a crossed another minor stumbling block in the mean time with the following line, where some hidden characters is preventing the existing pattern from reading it:
    o;?Mervan Bay 40 Boyde St 7 br t $250,000 X West Park AE
    Below is the existing regular expression that works for other lines with the same pattern but not for special hidden characters such as “o;?”:
    \\A([A-Z][a-z]*){1,2} [0-9]{0,4}/?[0-9]{0,4}-?[0-9]{0,4} ([A-Z][a-z]*){1,2} St|Rd|Av|Sq|Cl|Pl|Cr|Gr|Dr|Hwy|Pde|Wy|La [0-9] br [h|u|t] \\$\\d+,\\d+|\\$\\d*\\,\\d+,\\d+ ([A-Z][a-z]*){1,}\\ZIs it possible to come up with a regular expression to ignore them so that this line could be picked up? Would also like to know whether I could combine both the special pattern “\\A[^%].*\\Z” with existing one as opposed to using 2 separate patterns altogether?
    Many thanks,
    Jack

  • Match beginning of line with Regular Expression

    I'm confused about dreamweaver's treatment of the characters
    ^ and $ (beginning of line, end of line) in regex searches. It
    seems that these characters match the beginning of the file, not
    the beginning of the various lines in the file. I would expect it
    to work the other way around. A search like:
    (^.)
    should match every line in the file, so that a find/replace
    could be performed at the beginning of each line, like this:
    HELLO$1
    which would add 'HELLO' at the start of each line in the
    file.
    Instead, this action only matches the first character of the
    file, sticks 'HELLO' in front of it, and then quits (or moves on to
    the next file). The endline character $ behaves in a similar
    fashion, matching only the end of the file, not the end of each
    line.
    I've searched, and all the literature about regular
    expressions in dreamweaver seems to indicate that I'm expecting the
    correct behavior:
    www.adobe.com/devnet/dreamweaver/articles/regular_expressions_03.html
    quote:
    ^ Beginning of input or line ^T matches "T" in "This good
    earth" but not in "Uncle Tom's Cabin"
    $ End of input or line h$ matches "h" in "teach" but not in
    "teacher"
    Thanks for any insight, folks.

    Hi Winston,
    I am still digesting the material from the regular expression book and will take sometime to become proficient with it.
    It seems that using groupCount() to eliminate the unwanted text does not work in this case, since all the lines returned the same value. Ie 3 posted earlier. This may be because the patterns are complex and only a few were grouped together. Otherwise, could you provide an example using the string posted as opposed to a hyperthetic one. In the meantime, at least one solution have been found by defining an additional special pattern “\\A[^%].*\\Z”, before combining / intersecting both existing and the new special pattern to get the best of both world. Another approach that should also work is to evaluate the size of String.split() and only accept those lines with a minimum number of tokens.
    Anyhow, I have come a crossed another minor stumbling block in the mean time with the following line, where some hidden characters is preventing the existing pattern from reading it:
    o;?Mervan Bay 40 Boyde St 7 br t $250,000 X West Park AE
    Below is the existing regular expression that works for other lines with the same pattern but not for special hidden characters such as “o;?”:
    \\A([A-Z][a-z]*){1,2} [0-9]{0,4}/?[0-9]{0,4}-?[0-9]{0,4} ([A-Z][a-z]*){1,2} St|Rd|Av|Sq|Cl|Pl|Cr|Gr|Dr|Hwy|Pde|Wy|La [0-9] br [h|u|t] \\$\\d+,\\d+|\\$\\d*\\,\\d+,\\d+ ([A-Z][a-z]*){1,}\\ZIs it possible to come up with a regular expression to ignore them so that this line could be picked up? Would also like to know whether I could combine both the special pattern “\\A[^%].*\\Z” with existing one as opposed to using 2 separate patterns altogether?
    Many thanks,
    Jack

  • Entity validation with groovy expression

    Hi,
    I'm using jdeveloper 11.1.2.3.0
    I have an entity object with two attributes "status" and "reason".
    Only in case the user select status id "4" I would like to validate that he will select also reason.
    for this I was trying to add entity validation with groovy expression.
    so I added this expression "Status== 4 && Reason == null" and also I added failure message.
    But it doesn't work as I expected.
    The error is displayed every time, also when the user select status that is not 4 and also when he select status 4 and the reason is not null.
    How should I write this groovy expression?
    Thanks

    Just to clarify,
    If you add this validation to your status attribute then it will validate that Reason is not null when you change the status to 4.
    If you want to raise an entity validation just add a new Entity Validator and the expression should be something like what you had:
    But slightly different
    Status != null ? (Status==4? (Reason!=null) : true) : true

  • Match Regular Expression not returning submatches.

    I am having an issue with Match Regular Expression not returning the appropriate number of submatches.  My string is as follows:
    DATAM    995000    1.75    0.007    -67.47    24.493    99.072
    The spaces are tabs and the length is not fixed so simple string manipulation is out of the question.  The regular expression I was trying is as follows:
    (?<=\t)[0-9\.\-]*(?=(\t|$))
    It successfully returns Whole Match as the first number but no submatches are returned.  I've tried simpler expressions which work in Matlab and EditPad Pro such as [0-9.-]* but never got the same answer in Labview.
    What is going on?

    Here is an image of the VI.  The top portion is the input from our Licor 7000.  The bottom portion is the bit of code I'm having problems with.
    Attachments:
    matchregularexpression.jpg ‏336 KB

Maybe you are looking for