Reset Item After Regular Expression Validation Fails

Apex 4.2
I have a page item (P1_MYITEM) that should only hold alpha charaters, so I have created an item regular expression validation
using
^[a-zA-Z]+$
This works well, but now I want to reset my item (P1_MYITEM) to null
if the validation fails.
Tried using a page process, but they do not run if the validation fails.
Any ideas ?
Gus

Got it working using
Begin
  if not regexp_like (:P1_MYITEM, '^[a-zA-Z]+$')
    then
      APEX_UTIL.SET_SESSION_STATE('P1_MYITEM',NULL);
      return 'Country must be text characters only.';
  end if;
End;

Similar Messages

  • Inline display of error message for a regular expression validation

    Hi All,
    I am using ApexLib in my application.
    I am using regular expression validation for some of the items.
    Those validation will happen when the button is pressed and the message will be displayed as per the error.
    But, I want the errors to be displayed immediately when the focus is away from that item.
    as we do for required items.
    could anybody help me to achieve it?
    Thanks in advance
    bye
    Srikavi

    Hi Srikavi,
    to achieve a Validation of an item when leaving the field you'll have to use some javascript code (as ApexLib does internally).
    What do you need:
    - onChange - Event on your Item
    - some Javascript code which is called in the onChange Event (you can put this code either in your page html header or, if it is used more often in your application, in a seperate js File)
    - call the ApexLib method apexlib.error.showError to display your error
    I actually never tried it myself, but i'm pretty sure that this will work (according to what i've seen in the ApexLib code).
    Have fun and tell us how it went,
    Peter
    Edited by: peter_raganitsch on Sep 5, 2008 11:56 AM

  • Regular Expression Validator - want to edit an object acct field

    The field is a character field. But the field must be editted as follows:
    Field must either be 4 numeric numbers with the first position always an 8 so it could be a range from 8000 to 8999
    But I must also allow them to enter "8%" or "8n%" or "8nn%" where n represents a number. They want me to allow wild cards.
    How would I define this edit on the same field.
    1) First Validation: If it has a "%" then the first digit must be an 8 then I can have any of the wild card combinations given above.
    2) Second Validation: If no wild card then the field must be in the range from 8000-8999
    Is this validation a candidate for Regular Expression Validator or for my own custom method.
    If I can code this as a regular expression validator how would I code it. I spent the last day looking on the web for Regular Expression Validator examples.

    I get the following errors that occur. I can key 8% or 8ddd but when I try these combinations 8d% or 8dd% then the following errors pop up. It gives multiple error but I am just keying on a single line. I can add multiple object lines but just one at a time.
    java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    - JBO-ObjectCode_Rule_1: Object must be in range 8000-8999 or object must be in form of 8%, 8n%, 8nn% where n represents a number.
    - JBO-27008: Attribute set for ObjectCode in view object AccountsecuritygroupobjView2 failed
    - JBO-ObjectCode_Rule_1: Object must be in range 8000-8999 or object must be in form of 8%, 8n%, 8nn% where n represents a number.
    - JBO-ObjectCode_Rule_1: Object must be in range 8000-8999 or object must be in form of 8%, 8n%, 8nn% where n represents a number.
    - JBO-27008: Attribute set for ObjectCode in view object AccountsecuritygroupobjView2 failed
    - JBO-ObjectCode_Rule_1: Object must be in range 8000-8999 or object must be in form of 8%, 8n%, 8nn% where n represents a number.

  • Eclipse XQuery expression validation failed: The current configuration is out of sync with the XQuery resource in the repository.

    I created a wsdl based on a dbadapter in jdeveloper, imported into eclipse and created the biz and the proxy and uploaded to oracle service bus, it works fine,
    but happens now that i need to have a xsd and wsdl with business names and not table names, invented to create a xsd and wsdl file in jdeveloper
    and then went to eclipse and tried t xquery tranformation, but when i add the replace in the message flow in the filed in Variable : body and Expression i look for the xquery and in the binding trying to put
    $body/input parameter, get the following error [RouteNode1, Replace action] XQuery expression validation failed: The current configuration is out of sync with the XQuery resource in the repository.
    what im doing wrong or its configuration
    thanks in advance sonia

    thanks
    ok have created a table with only in column varchar2(1)
    then the type object and the procedure to insert it works the proxy in the osb if i test it inserts
    now in jdeveloper i created an xml file with
    <?xml version="1.0" encoding="windows-1252" ?>
    <vessel>
    <barco>a</barco>
    </vessel>
    then i created a xsd based on this xml, and a wsdl based on the xsd
    in eclipse created a xquery transformation and selected source as the xsd created in adf and target the xsd input parameter, dont know why in the purple ball of the input parameter it puts a ?, an a f.
    then in the proxy xpath not writing anything in variable body and in the expression select the xquery and in binding select the parameter

  • Failed to issue COM RESET successfully after 3 attempts. Failing...

    Just in case anyone else has this problem, and wants to claw their eyes out.
    I upgraded the Hard Disk in my MacBook Pro about four days ago (the new MBP, summer 2009 with SD card). I installed a Hitachi Travelstar 7K320. It worked awesome for about four days, until I went to run the EFI Firmware Update this morning.
    My machine stopped booting. I held Command-V to get the verbose boot output, and eventually got the message: Failed to issue COM RESET successfully after 3 attempts. Failing... - which is where the boot halted.
    I removed the Hitachi and restored the stock drive, and the laptop now booted fine. I think it's something Apple will have to look into.

    I believe posting relevant facts is productive, & a very relevant fact here is that you are trying to use a drive with an interface (SATA-II) that Apple does not currently support in its laptops.
    SATA-I controllers are supposed to be compatible with SATA-II drives, but many of them are not. The problem is how some controllers implement auto negotiation, which is supposed to tell the drive to fall back to SATA-1 speeds with the slower controllers. Some SATA-II drives have a jumper to force the slower speed if auto negotiation doesn't work; some do not.
    How this compatibility problem came about, & why the jumper is required, is complicated but the short version is that at least four different specification bodies had some responsibility in producing SATA specifications, & not all controllers were designed to the same standards. This includes not just the controllers Apple has been using but those in many PC's as well.
    So I agree that Apple dropped the ball, but not necessarily the way you might think: it should have made it very clear that the firmware update implemented an unsupported interface speed, that it might cause problems, & (most importantly) provided a reversion strategy to the former firmware if it did.
    Hopefully, Apple will take another 'swing' at this & either provide that reversion strategy or a new update that at least allows the controller to work more reliably with the faster interface. But until then, unless your drive has the jumper, my previous suggestion is probably the best you can do.
    BTW, none of the current mechanical drives available for laptops can saturate a SATA-1 bus except for brief bursts from the drive's buffer, so the real loss in performance of running a single SATA-II drive at SATA-1 speeds is almost negligible, something you might notice in a benchmark but not in real-world use.

  • Regular Expression Validator Problem

    Hi,
    I have a text area that I want to use a regular expression
    validator on to verify that one or more 9 char alphanumeric serial
    numbers were entered.
    <mx:RegExpValidator
    source="{entryField}"
    property="text"
    flags="gi"
    expression="{/[a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0-9][a-zA-Z0- 9][a-zA-Z0-9][a-zA-Z0-9](
    |,|\\n|\\r|\\t)/}"
    valid="handleResult(event)"
    invalid="handleResult(event)"
    trigger="{entryField}"
    triggerEvent="textInput"
    />
    //for testing
    private function
    handleResult(eventObj:ValidationResultEvent):void {
    if (eventObj.type == ValidationResultEvent.VALID)
    entryField.setStyle("borderColor", "green");
    entryField.setStyle("borderThickness", "2");
    else
    entryField.setStyle("borderColor", "red");
    entryField.setStyle("borderThickness", "2");
    The problem is the handler function always comes back
    invalid, even when it should be valid, such as: 123456789 a12345678
    lk231jkop
    Can anyone advise where I might be going wrong?
    Thanks!

    This is weird, i just tried your RegExp using the Adobe's
    Live Docs example and it worked perfectly.
    Try it at:
    http://livedocs.adobe.com/flex/201/langref/mx/validators/RegExpValidator.html
    Scroll down to the end of the page, then type your RegExp and
    your TestValue and click the Validate button, it works. I am
    guessing that maybe it is your
    i
    flag, try removing it from your validator.
    Hope this helps

  • Validation on text item as Regular Expression Question(Repetition Operator)

    These are my success entries for a field;
    123456,
    123456,123456,
    123456,123456,123456,
    123456,123456,123456,123456,
    "," seperated 6 digits can be repeated unlimited times.
    I found on documentation this; "Repetition Operators; {m,}     Match at least m times" and for my need i tried this regular expression; "^[[[:digit:]]{6},]{1,}$", but didnt worked :(
    Any comments?
    Thank you very much :)
    Tonguc

    Your expression is a little incorrect because you can't use repetition operators within a bracket expression. How about something like this
    "^([[:digit:]]{6},)+$"
    Regards,
    Peter

  • Regular Expression Validation

    Hi,
    I'm trying to use a regular expression to validate password.
    I create a validation in my item called P502_PASSWORD. I choose regular expression type. At the Validation Expression 2, I put this expression:
    ^(?=.*\d)(?=.*[a-zA-Z])(?!.*[\W_\x7B-\xFF]).{6,15}$
    So, I tried to enter a valid "string" at this item. For example: abc123
    But it doesn't work and I don't know why. I have another item with a e-mail validation with the expression below, and works:
    ^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$
    So, i really don't know what is happening.
    Can someone help me? :)
    Thanks,
    Vivi

    Hi Vivi,
    I checked your regex with my favourite application and it seems to be correct for a 'liberal' interpreter. But POSIX-implementation in Oracle seems to be quite strict. At least, I get an ORA-12728 ("invalid range in regular expression") when executing your string with "REGEXP_LIKE". I would take the regex apart bit by bit and see when the regex starts to work with REGEXP_LIKE, like in the following example:
    BEGIN
      dbms_output.put_line(case when regexp_like('aBc123','^(((\d)|([[:alpha:]])){6,15})$') then 'hit' else 'miss' end);
    END;
    /This is of course not exactly the expression you wanted, but I guess it's not very far away and produces a 'hit'. ;)
    If anybody finds out what exactly caused the error I'd like to know. My first guess was the asterisk in combination with {6,15}, but just removing it didn't do the trick.
    -Udo

  • Tomahawk Regular expression Validator

    Hi,
    I am trying to use Tomahawk RegEx Validator in my application.
    My questions are as follows.
    1. I want to get the pattern of the regular expression from the bean or resource bundle. Is this possible?
    2. If I use the pattern as in <t:validateRegExpr pattern='[a-zA-Z\s]+'/> it works perfectly fine. But when I change that to <t:validateRegExpr pattern='\\p{N}+'/> it doesn't work. I want to do this as there won't be any issues with internationalsation.
    Please let me know how these issues can be addressed.
    Thanks in Advance.
    Regards,
    Raja

    manick_r wrote:
    1. I want to get the pattern of the regular expression from the bean or resource bundle. Is this possible?Read the TLD documentation of the tag in question. If the 'pattern' attribute accepts a ValueExpression, then it is possible. I can't directly answer this as you're at a Sun JSF forum, not at an Apache Tomahawk mailinglist.
    2. If I use the pattern as in <t:validateRegExpr pattern='[a-zA-Z\s]+'/> it works perfectly fine. But when I change that to <t:validateRegExpr pattern='\\p{N}+'/> it doesn't work. I want to do this as there won't be any issues with internationalsation.Please elaborate "it doesn't work". What did you expect it to do and what did it do unexpectedly instead? Does this pattern work when you just use it in String#matches()? Provide a SSCCE if you can.

  • Regular Expression Validator

    Are there plans to include a validator based on regular expressions in the first releae of JSF. I can imagine many consumers of JSF writing their own if one isn't provided out of the box. I know .NET has such a thing.

    I would also like to vote for such a thing.
    Does anyone know whether the JSF crew is reading these posts?
    I was really wondering why this validator is missing and I fear that it is missing because some JSF people don't want one, since otherwise having a regexp validator would be the most intuitive validator to have.
    Some frameworks combine regexp matching with internationalization and localization. This is one aspect that does not really have to be considered with the validators out so far. Maybe that is the reason for why the RegexpValidator is missing.
    Also, since JSF needs to be compatible to JDK1.3, there would have to be an extra regexp package like oro to be included within the faces implementation. And someone would have to write a validator using this package for jdk1.3 and another one using the jdk1.4 buildin regexp package. Maybe that's why there is not yet one available...

  • Problem with  regular expression  validation

    hi,
       how can i validate folder structure
       conditions
         no two  forward slashes(/) in a sequence no  special characters
        " /w" and   "  '/'  "    
       e:/tomcat/ss/ss.text
           if(valStr.matches("((['/'])[a-zA-Z0-9_]*)")){
                    System.out.println("matches");   
             else
                    System.out.println("notmatches");
    this is no correct .
    please give me right solution       
    with regards
    ss

    hI,
      /appmg/dd/
    is  the paths for solaris( starts with /)
    i have to test  if it is valid path name or not
    with regards
    ss

  • Regular Expression Validation Puzzle

    Simple validation of a incomming contact name ..
    $contact_name = trim($_POST['contact_name']);
    if (!ereg("^([a-zA-Z \'-]+){5,10}$", $contact_name))
    { $errors [] = 'Enter valid contact name'; }
    As you can see the name must be u/l case alpha or space,
    apostophe or hyphen (I think that is all a name can be) and must be
    at least 5 chars and no more than 10 (just testing).
    The character validation seems ok and it picks up when there
    is less that 5 chars, but the max parameters doesn't seem to work
    at all - any ideas?
    PS. Is there a routine that strips out more than one space
    between words, e.g if someone entered 'John Smith', it would return
    'John Smith'?,
    Thanks.

    Hi David,
    I have tried this and I am still getting an unexpectred
    error:
    Joe O'Kane appears on my error message as invalid - Joe
    O\'Kane (11 Characters) whilst
    Joe O-Kane appears as valid Joe O-Kane (10 Chars)?
    I have tried both suggested scripts - my code is ...
    $errors = array();
    if (get_magic_quotes_gpc())
    { function undoMagicQuotes($array, $topLevel=true)
    { $newArray = array();
    foreach($array as $key => $value)
    { if (!$topLevel) { $key = stripslashes($key); }
    if (is_array($value)) {$newArray[$key] =
    undoMagicQuotes($value, false); }
    else { $newArray[$key] = stripslashes($value); }
    return $newArray;
    $_GET = undoMagicQuotes($_GET);
    $_POST = undoMagicQuotes($_POST);
    $_COOKIE = undoMagicQuotes($_COOKIE);
    $_REQUEST = undoMagicQuotes($_REQUEST);
    //if (get_magic_quotes_gpc())
    //{function stripslashes_deep($value)
    //{ $value = is_array($value) ?
    array_map('stripslashes_deep', $value) : stripslashes($value);
    //return $value; }
    //$_POST = array_map('stripslashes_deep', $_POST); }
    $val_cn = trim(preg_replace('/\s+/', ' ',
    $_POST['contact_name']));
    $val_cn = mysql_real_escape_string($val_cn); // Just want to
    see the effect of this function
    $cn_html = htmlentities($val_cn); // Just want to see the
    effect of this function
    if (!preg_match("/^[-a-z'\s]{5,10}$/i", $val_cn))
    { $errors [] = 'Invalid contact name: ' . $val_cn . ' ' .
    $cn_html; }
    else
    { $errors [] = 'Valid contact name: ' . $val_cn . ' ' .
    $cn_html; }
    if (sizeof($errors) > 0)
    // format and display error list
    { echo "<p class=\"val_err\"> Contact format
    error.</p>";
    echo "<div class=\"val_err\"><ul>";
    foreach ($errors as $e)
    { echo "<li>$e</li>"; }
    echo "</div></ul>"; }
    Any help much appreciated.
    Regards.
    Patrick

  • Alphanumeric and pipe delimiter regular expression validation

    i have a header in file like below
    EMP_ID|EMP_NAME|DEPARTMENT|SALARY|ACTIVE1
    passed to a string
    String test = "EMP_ID|EMP_NAME|DEPARTMENT|SALARY|ACTIVE1";
    I have to check if the header has only alphanumeric and pipedelimiter is allowed.
    other than these i need to raise an error.
    Any sugestions.

    hi rp0428  thanks for ur suggestion.
    yes i found string pattern matching.
    public boolean isAlphaNumeric(String s){
       String pattern= "^[a-zA-Z0-9]*$";
       if(s.matches(pattern)){
       return true;
       return false;  
    but i am looking for regexp which matches pipe delimiter as well like
    EMP_ID|EMP_NAME|DEPARTMENT|SALARY|ACTIVE1
    should return true. else if
    EMP_ID , EMP_NAME , DEPARTMENT , SALARY ,, ACTIVE1
    other than pipe delimiter like comma or space it should throw error message.
    thanks.

  • Item Validation using Regular Expression

    Hi,
    I am trying to apply a Validation to a text field item, with the type as Regular Expression.
    The text input into the field should be in a HH:MM:SS format, ie 05:30:00 (for 5:30am).
    The text I am placing in the 'Validation Expression 2' box is:
    [0-2][0-9]\:[0-5][0-9]\:[0-5][0-9]
    This doesn't seem to work and I get an error message when I enter text in the correct format.
    I have even tried to use other comparisons, for example:
    or
    .{8}
    but these still give me an error message.
    Anyone have any ideas?

    Thanks for your help Flavio, the Regular Expression tool is really helpful.
    When I use this tool to compare strings with my regular expression, I get output = TRUE, which means I'm getting it right, but for some reason when I copy the same Regular Expression syntax into APEX, it doesn't work.
    I try to input correct strings into the field that is validated by the Reg Expr, but it still gives me an error.
    It seems to be something I am doing wrong within the application, but I can't figure out what I'm missing.
    I am creating an Item Level Validation with details:
    Type: Regular Expression
    Validation Expression 1: P23_BUS_DAY_COVERAGE_START
    Validation Expression 2: ^(([0-1][0-9])|(2[0-3])):[0-5][0-9]:[0-5][0-9]$
    Has anyone had similar problems using regualr expression validation in APEX?

  • Hard Drive dead? - Failed to Issue COM RESET successfully after 3 attempts.

    Hello, i think my 13" 2.53Ghz Unibody (mid2009) MBP's hard drive has had it's last spin. I was using it normally in bootcamp, when windows7 froze, so I rebooted holding the power button....windows wouldnt start any more...ok, so i tried to boot into OSX...stuck at the loading screen with the apple.
    Went into verbose mode and it stops at "Failed to issue COM RESET successfully after 3 attempts. Failing..." Google says this has to do with the hard drive.
    Did a extensive hardware test (boot + D), all OK, booted from install disk and tried to run disk utility, but it crashed when trying to locate the drives (didn't even list the drive on the right pane). Single User mode wont load either, will give the same COM RESET message. I am literally out of options here.
    Is there something i can do to either fix this or verify 100% that my hard disk is truly dead?
    I have a backup in timemachine so the data is ok, but the timing couldnt be worse, i have no time to fix this now and needed a working laptop, highly frustrating.
    thanks for any tips

    nobrex wrote:
    Hello, i think my 13" 2.53Ghz Unibody (mid2009) MBP's hard drive has had it's last spin. I was using it normally in bootcamp, when windows7 froze, so I rebooted holding the power button....windows wouldnt start any more...ok, so i tried to boot into OSX...stuck at the loading screen with the apple.
    Went into verbose mode and it stops at "Failed to issue COM RESET successfully after 3 attempts. Failing..." Google says this has to do with the hard drive.
    Did a extensive hardware test (boot + D), all OK, booted from install disk and tried to run disk utility, but it crashed when trying to locate the drives (didn't even list the drive on the right pane). Single User mode wont load either, will give the same COM RESET message. I am literally out of options here.
    Is there something i can do to either fix this or verify 100% that my hard disk is truly dead?
    I have a backup in timemachine so the data is ok, but the timing couldnt be worse, i have no time to fix this now and needed a working laptop, highly frustrating.
    thanks for any tips
    Welcome to the Apple Forums!
    Your HDD is probably dead, since the error doesn't appear to indicate something wrong with the motherboard. Just buy a new 2.5" HDD. I don't know about prices in Brazil, but here in the US, a 1TB drive runs for around US$100. Also, check on eBay for people who upgraded their drive and are selling their Apple drive. Some will ship to Brazil, and you can score those for $50-100.
    I hope you backed up your hard drive. If not, you'll have to do the whole reinstallation process.

Maybe you are looking for