Validating an action expression

How can I check programmatically that an action exists in the faces context?
I am writing a JSF application that builds itself at runtime based on database-stored settings. Our less experienced developers will use a configuration wizard (also a part of the same JSF application) to specify some values and actions based on the needs of the installation. In some cases, they will specify the action behind a button. I need to check the action that they enter to make sure it exists to avoid common mistakes typos etc. I know how to be validate an el expression, but is there a way to see if it will actually map to something?
Many thanks in advance!

Edit: nvm, misunderstood the question.
You can use reflection to check if a method in a class exists.
Message was edited by:
BalusC

Similar Messages

  • 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

  • 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

  • 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.

  • Onclick validation and action for a4j:commandbutton

    Hi, I have a requirement: when i click on a button, it has to show ok/cancel dialog box and if it is ok, then we have to call server code in ajax manner, else just be there doing nothing.
    I implemented like below:
    Case 1:
    JSF code:
    <a4j:commandbutton id="id1" value="Delete" onclick="showValidation()" action="#{bbean.deleteAction}" />.
    JS code:
    function showValidation()
    if(confirm("Are you sure you want to delete?"))
    return true;
    else
    return false;
    It showed me the validation, but irrespective of Ok/Canel button that i clicked, the action's bbean.deleteAction gets executed.
    I changed the JSF Code a little by providind return in the onclick as below,
    Case 2:
    <a4j:commandbutton id="id1" value="Delete" onclick="return showValidation()" action="#{bbean.deleteAction}" />.
    This time, It showed me the validation, but irrespective of Ok/Canel button that i clicked, the action's bbean.deleteAction is NOT executed
    I have tried several combinations, but no use. can anyone in the java world help me resolviing this issue? Thanks in advance and any small help in acheving my task is greatly appreciated.

    On the initial 'Delete' button change action to be action="javascript:void();"
    In your confirmation dialog have two buttons. Ok will invoke the original delete action, and cancel will simply close the confirmation dialog.
    m

  • Validation for regular expressions special characters in java

    Hi,
    I need to validate an user name field to an application while creating that. It has to contain only alpha numerics. can you give me the regular expression and also how to implement that.
    thanks,
    VJ

    Do your own work. Look up the documentation on Pattern and make an attempt at validating a String yourself. Then worry about implementing a GUI on top of that.

  • 10GR2 - No Validation Message in Expression

    Hi
    While using 10GR2, sometimes when I try to validate an expression, I don't get
    any message in the 'Validation Results' box.
    I have to quit out of OWB and log back in then try again. When I validate again I get the 'Validation Successful' message.
    This is happening frequently for no apparent reason.
    Is anyone else experiencing this or know what causes it?
    Thanks
    GB

    There is some OWB Releases that this feature simply does not work.
    I was using OWB 9.2.0.3. The validation for a simple expression, such as a SUBSTR, takes a really long time and fails with this wierd sdk.whatever... message. Replaced with OWB 10.1.0.2.0 and now I don't have this issue anymore. However, it still takes long time to validate simple expressions.....
    Don't know if there's a patch for that, I never worried about it since OWB validation messages doesn't necessarily reflects problems in the app's you've developed.
    Regards,
    Marcos

  • 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?

  • Field validation by regular expressions?

    Hi everyone,
    I just started with SoD and I'd like to ensure that some field values consists of alphabetic characters only (FirstName, LastName...). I failed to create an adequate expression. Is there a possibility to use regular expressions?
    TIA
    Michael

    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.

  • EMAIL VALIDATION USING REGULAR EXPRESSIONS

    Hi All,
    I am new to regular expressions and am trying to learn about them.
    As practice I am trying to develop a query to filter out invalid e-mail id's eg:-
      <some-name>.<some-name1>@gmail.com - VALID
      <some-name>_<some-name1>@gmail.com - VALID
      <some-name>@<some-name1>@gmail.com - INVALID
    Lets say the column name is EMAIL_ID
    So I have the expression to validate the email end as follows
       select email from <table-name> where REGEXP_LIKE (EMAIL,'.com$') However i have no idea (wheter it is even possible) to filter out the third email id
    on the condition that it has *2 @*
    Any help regarding this would be welcome

    I would recomend you to look at
    http://psoug.org/reference/regexp.html
    And will you find answers of your questions...
    Shortly my comment to your questions...
    1. [A-Za-z0-9._%+-]Here why is %+- included in the pattern?
    Are they parts of a valid email-id?[char] Indicates a character list; most metacharacters inside a character list are understood as literals, with the exception of character classes, and the ^ and - metacharacters. Yes they are a part of valid email.
    2 +@What is this part doing?
    Is + some kind of concatenate operator to help you combine various expressions?+ is means that Character before Match 1 or more times. Your statement before "[A-Za-z0-9._%+-]" must be exist.
    3 \.Is this used to validate the . as in .com ? Point (.) by himself means One character (whenever which one). By typing \. you want to see exactly point.. \ "takes" from point "command power" and point(.) become simple character.
    4 {2,4}
    Emails end in .com then what is the use of putting this range {2,4}?{m, n}     Match at least m times but no more than n times.
    You want characters after pount in range 2 and 4. i.e. ru, com, az, net and so on...
    Hope this was helpfull for you...

  • Dynamic-actions/expressions for Radio button in VC

    Hi,
    I would like to know whether dynamic actions for radio-buttons are possible in VC??
    I have a situation where, i have to display/hide an input-field according to the radio-button that i select.
    Is this possible in VC??
    Because, i do not find any place where i can write expressions for a radio-button so that it can take actions accordingly.

    Actually its possible.
    Here is the sample code for this.
    tables : kna1.
    parameters : chk1 radiobutton group g1 user-command abc,
                 chk2 radiobutton group g1.
    parameters : chk3 type kunnr.
    at selection-screen output.
    loop at screen.
      if chk1 = 'x' and screen-name = chk3.
          chk3-active = '0'.
      endif.
    endloop.
    In this way you can hide a input-field on the screen.

  • Clicking worksheet tabs cause "evDRE: Validating EVDRE" action

    BPC 5.1 SP3
    I have a workbook with two worksheets--each contains one evDRE. Can anyone explain why when I click on any of the two worksheet tabs, some sort of refresh action is triggered? For example, while on worksheet A, I click on worksheet B's tab and notice a slight lag and the status bar displays "evDRE: Validating EVDRE".
    I can't replicate the issue using a new, blank workbook. The "Refresh by Sheet" eTools workbook option is not enabled, but it seems like that's the behavior I'm noticing.
    UPDATE:
    Figured it out. This behavior appears to be caused whenever using the "worksheet dimension locks" option. I was able to replicate it using a new, blank workbook. Create one evDRE on each of two worksheets. Enable the "worksheet dimension locks" on each worksheet. Now, clicking on either worksheet triggers some sort of refresh/update action.
    Edited by: John Kreps on Nov 18, 2008 9:53 AM

  • Create Validation in Application express 3.0

    Hi all,
    I am trying to create a validation for a text field but having some issues. Basically what I want to do, in a customer form when all the information filled up and click on create. it will check the customer identification number in the database and returned with error if the identity is exist. Identification number is a random generated number.
    I am selecting 'EXIST' in the type field and typed the following in expresson 1 field -
    select cust_num from customers
    but seems it is not passing the validation.
    ANY IDEA PLEASE !!!

    guessing that there will be a good reason for generating a random number and then checking if it exists (with an error message), let's have a look at your problem.
    You probably want to use a query like
    select 'x' from customers where cust_num = :P1_CUST_NUM
    where P1_CUST_NUM is the name of the item you wish to validate.

  • Password Validation using Regular Expression

    Please help me wit the regular expression for the password policy mentioned below:-
    The password length should at least be 8 characters. It should be a combination of at least any two of the given sets.
    a. Set of alphabets a-z, A-Z
    b. Set of numerics 0-9
    c. Set of special characters ~!@#$ etc.

    function validatePassword(fieldName,minNumberOfDigits, maxNumberOfDigits) {
    var alphaNumericPattern = "^[a-z0-9/_/$]{" + minNumberOfDigits + "," + maxNumberOfDigits + "}";
    var regExpr = new RegExp(alphaNumericPattern,"i");
    var sourceField = event != null ? event.srcElement:e.target;
    if(fieldName != null && fieldName != "null" && fieldName != "undefined") {
    sourceField = document.getElementById('OrdFrmsessionValidater:form1:passwordField2');
    var message = "Password must be a combination of alphabets and numbers";
    message = message + "\n and must be between " + minNumberOfDigits + " and " + maxNumberOfDigits + " chars.";
    var sourceFieldValue = sourceField.value;
    if(sourceFieldValue.length < minNumberOfDigits || sourceFieldValue.length > maxNumberOfDigits){
    alert(message);
    sourceField.focus();
    return false;
    if (!regExpr.test(sourceFieldValue)) {
    alert(message);
    sourceField.focus();
    return false;
    regExpr = new RegExp("[a-z/_/$]{1}","i");
    if(!regExpr.test(sourceFieldValue)){
    alert(message);
    sourceField.focus();
    return false;
    regExpr = new RegExp("[0-9]{1}","i");
    if(!regExpr.test(sourceFieldValue)){
    alert(message);
    sourceField.focus();
    return false;
    var alphaNumericPattern = "^[a-z0-9/_/$]{" + minNumberOfDigits + "," + maxNumberOfDigits + "}";

  • String validation without regular expressions

    Hello all
    I'm facing a little problem, basically i have to make a method that validates an input String "a name"
    Numbers and symbols are not allowed, but white spaces are.
    The method has to be implemented without the use of JFormattedTextField or regular expressions.
    What i'm doing right now is this:
    public boolean validate(String name){
       char[] arr=name.toCharArray();
        for(Char c:arr){
          if(!Character.isLetter(c)){
           return false;
      return true;
    }That isLetter() method is very useful but it sees the white spaces are "non letters".
    I am a bit lost at this point, i'm trying a lot of methods of String and Character but nothing seems to work
    do you have any advice?
    Thx

    enrico wrote:
    That isLetter() method is very useful but it sees the white spaces are "non letters".
    I am a bit lost at this point, i'm trying a lot of methods of String and Character but nothing seems to work
    do you have any advice?Yes: don't try to do it all in one expression. 'If' statements allow you to use '&&' and '||' to connect expressions, so use them.
    Second: Work out what you want to do BEFORE you start programming.
    In this case, you need to know exactly which characters you want to allow, +and when+ (see baftos' examples above).
    Third:for(Char c:arr){is meaningless (unless you've defined a class called 'Char').
    Accuracy is important.
    Winston

Maybe you are looking for

  • Apple Loops no longer work!!!

    Hi I have a strange problem. I imported an apple loop from the Library>Audio folder into ProTools via drag and drop. Pro Tools created a copy of the audio file in the local ProTools audio folder. Strange thing is now the OS and all the iLife apps can

  • Where can I find a sample of application with textboxs ,buttons and ..

    Hi, I'm new to Java and I'd like to know where can I find a sample of application with textbox, buttons and accessing a database (Oracle or MS-Access) something like a commercial application to start my knowledge in Java. I'm a developer and I use Vi

  • Digital I/O

    I am using the DAQ card (PCI-6025E). The digital output is set to "1" once I open a program in LabVIEW,but not yet run the program. Is there any method to configure the default value of the digital output to "0" ? Thank you.

  • Channel 4 to place pre-roll ads on BT Vision

    From: http://www.iptv-news.com/iptv_news/february_2010/channel_4_to_place_pre-roll_ads_on_bt_vision I hope this doesn't get to be applied to the subscription Replay service. I have no objection to viewing adverts if the content is free i.e. itv playe

  • Sony PRS-300 ereader not working with Lion

    Hello I updated to OS Lion on 20 July and now find that my ereader (Sony PRS-300) is not recognised by my Mac when I plug in the USB. It worked perfectly before! Am unable to locate any help on the Sony site and the problem only occirred after instal