Commons validator validwhen rules

I have a form, something like this:
<html:radio property="type" value="1" /><html:text property="field1"/>
<html:radio property="type" value="2" /><html:text property="field2"/>
<html:radio property="type" value="3" /><html:text property="field3"/>
It need to apply some validation rules on the fields: field1, field2, field3 only if set
proper html:radio ... So if we choose type=1 then filed1 must be validate on required and
mask rules, but field2 and field3 should stay untouchable(without validation).
How can I configure it in validation.xml ? Is it possible ? I think validwhen rules must
be applied.
My variant below (but it's not working as I expect):
<field property="field1" depends="validwhen, integer, intRange">
<arg0 key="test.field1"/>
<arg1 name="intRange" key="${var:min}" resource="false"/>
<arg2 name="intRange" key="${var:max}" resource="false"/>
<var>
<var-name>test</var-name>
<var-value>((type!=1) or (*this* != null))</var-value>
</var>
<var>
<var-name>min</var-name>
<var-value>1</var-value>
</var>
<var>
<var-name>max</var-name>
<var-value>99</var-value>
</var>
</field>
Validation performing in anyway, independently what type selected(type==1 or
type==2 or type==3)...

Javascript validation? Yup, looks like your code is calling
a Javascript method all right. But you didn't post the
code that contains that method.Just to clarify a bit on this, as it is rather struts specific.
The validator framework lets you define your validations in the validator.xml file, and does the validation server side.
Struts also has a tag that will generate a javascript function to do the validation client side as well. : <html:javascript formName="loginForm" />
If you view source on the generated page, you would get the generated function.
The code posted looks valid as far as that goes.
My guess: The i18n lookup is failing and returning null.
Are loginForm.email and loginForm.password defined in the resource bundle props.ApplicationResources?
To double check this try changing the struts-config messageResources tag:
<message-resources parameter="props.ApplicationResources" null="false"/> so that instead of null (probably being converted to empty string) you should see a message like ???loginForm.email??? is required.
Hope this helps,
evnafets

Similar Messages

  • Commons Validator validwhen error

    I am trying to use the validwhen but it wont work and display a javascript message. I assume you can do javascript validation with it since it sends the required message out, but then again maybe I am just assuming things. It will check for everything else but simply skip over the validwhen section. I've tried it in two different forms.
    validator.xml
                   <form name="checkoutForm">
                   <field property="creditCardName" depends="validwhen">
                        <arg0 key="checkoutForm.creditCardName"/>
                             <var>
                                  <var-name>test</var-name>
                                  <var-value>(paymentOption == 'creditcard')</var-value>
                             </var>
                   </field>
                   <field property="creditCardNumber" depends="creditCard">
                        <arg0 key="checkoutForm.creditCardNumber"/>
                   </field>
              </form>
                  <form name="createUserForm">
                  <field property="firstName" depends="required">
                       <arg0 name="required" key="createUserForm.firstName"/>
                  </field>
                  <field property="lastName" depends="required">
                       <arg0 name="required" key="createUserForm.lastName"/>
                  </field>
                  <field property="phone1" depends="required, integer">
                       <arg0 name="required" key="createUserForm.phone1"/>
                       <arg0 name="integer" key="createUserForm.phone1"/>
                  </field>
                  <field property="phone2" depends="required, integer">
                       <arg0 name="required" key="createUserForm.phone2"/>
                       <arg0 name="integer" key="createUserForm.phone2"/>
                  </field>
                  <field property="phone3" depends="required, integer">
                       <arg0 name="required" key="createUserForm.phone3"/>
                       <arg0 name="integer" key="createUserForm.phone3"/>
                  </field>
                  <field property="email" depends="required, email">
                       <arg0 name="required" key="createUserForm.email"/>
                       <arg0 name="email" key="createUserForm.email"/>
                  </field>
                  <field property="password" depends="required, minlength">
                       <arg0 key="createUserForm.password"/>
                       <arg1 name="minlength" key="${var:minlength}" resource="false"/>
                           <var>
                                <var-name>minlength</var-name>
                                <var-value>6</var-value>
                           </var>
                  </field>
                  <field property="passwordConfirm" depends="required, validwhen, minlength">
                       <arg0 key="createUserForm.passwordConfirm"/>
                            <var>
                                  <var-name>test</var-name>
                                  <var-value>((password == null ) or (*this* == password))</var-value>
                             </var>
                       <arg1 name="minlength" key="${var:minlength}" resource="false"/>
                           <var>
                                <var-name>minlength</var-name>
                                <var-value>6</var-value>
                           </var>
                  </field>
             </form>Can anyone help? Not sure what else you would need to look at. I have commons-validator-1.3.1.jar and antlr.jar (read you need that for validwhen) and I am using http://jakarta.apache.org/commons/dtds/validator_1_1_3.dtd for doctype. Need anything else just let me know. Thanks for the help!

    Hi,
    The mismatch is the problem. Please get the latest files from Struts 1.2.x and update your project.
    http://struts.apache.org/downloads.html
    Then it would work.
    cheers
    babu

  • Error while validating Business Rule (Error Cause: nativeGetNewTLA Rule)

    Hi, I am receiving an error while validating business rules
    An error occurred in: Rule:HypLive.Plan1.Product Interest
    A validation error was received from the Planning server 'http://abc:8300/HyperionPlanning/servlet/HspAppManagerServlet?appname=HypLive'.
    'Error:
    Error Cause: nativeGetNewTLA Rule HypLive.Plan1.Product Interest'.

    Are you able to validate the rule in EAS (or Calc Manager)?
    Normally nativeGetNewTLA Rule is followed by out of memory errors like java.lang.OutOfMemoryError,
    Increase the heap size to 1024, re start Planning and try validating it again.
    Cheers..!!

  • Valid settlement rules

    We received a request from the business to block time entry charges for WBS with C* status. Also, block time
    charges for PM order and Network order if their settlement receiver WBS is in C* status.
    I was trying to find a transaction or functionality in SAP that will provide me all valid settlement rules (senders and receivers) in a given project.
    Before users can charge labor time to a charge object 'orders' (PM or network orders), validity of the settlement rules need to be checked. If there's a valid settlement rule, the status of the settlement receiver will be checked to determine if time entry for the charge object can be allowed.
    Basically, what I'm looking for is anything that will give me the valid settlement rules of the settlement receiver given a specific period or date.

    Hi
    Even though system allows you to specify the percentage in PM order ,it will not allow you to settle the cost.Just execute the settlement process KO88 and check
    regards
    thyagarajan

  • Validation Business Rule Problem

    Hi Community
    I´m working with SAP BPC 7.0 NW SP09 Consolidation, the problem I have is when I execute the validation package, the result of the Validation Rule because the business rule don´t respect the number sign of the value calculated.
    For example I try to confirm this formula ASSETS = LIABILITIES + EQUITY
    ASSETS      AST   1000
    LIABILITIES  LEQ     800
    EQUITY        LEQ     400
    RESULT                  -200
    BUSINESS RULE      200
    I was investigating all the posible combinations of dimensions, and I found it could be possible that this error occurs when (Liabilities + Equity) > Asset.
    Rule                                   
    VAL01     ASSETS=LIABILITIES                         
    Rule Details                                   
    Validation Account     Account 1     Flow 1     Sign 1     Account 2     Flow 2     Sign 2     REMARK
    VAL01     ASSETS     F_CLO     1     LIABILITIES     F_CLO     1     
    ASSETS and LIABILITIES are configures as part of dimlist property, where Liabilities have all the equity accounts too.
    Hope anyone help me with this problem
    Thanks in advance

    Hello Ruben
    If Account: VAL01 is 'AST' account than Validation Business Rule will give 200 as the result.For 'LEQ' result will be -200.
    I think the business rule is working as expected.
    Hope this help.
    Regards
    Venkatesh KPS

  • Validation business rule on a cumulative basis with periodic data storage

    Hi BPC Experts,
    Is it possible to set up a validation business rule on a cumulative basis when we have periodic data storage type?
    Appreciate your assistance with this.
    Thanks.
    Mila

    Hi Mila
    Please could you tell me how you solved the issue?
    We have it the other way round, a YTD storage, but would like to validate accounts on a periodic basis.
    Thanks for sharing your findings.
    Melanie

  • Validation business rule

    Hi,
    I am trying to reconcile account 1 with accounts 2 to 8 with a validation business rule. When I define the rule, I have one line with account 1 and account 2 filled and another 6 lines with only account 2 filled. This creates an error on validating the rule.
    How can I create such a validation rule?
    Thanks,
    Arnold

    Instead of using a validation rule I have set this up as an account transformation rule which works just as well and doesn't generate any errors.

  • Validation Business rules..

    Hi all,
              Does the validation business rules work on parent/ calculated members of other dimension other than the account and the account flow..
    im using the accounts
    SOURCE..
    ACCOUNT              ACCOUNTFLOW      OTHERDIM1
    SR10313000     F_CLO                        NONE1
    DESTINATION
    ACCOUNT              ACCOUNTFLOW      OTHERDIM1
    SA10411200     F102                           PARENT
    SA10411200     F103                           PARENT
    which   PARENT has a CHILD1 AND CHILD2 children.....
    Thanks..

    Hi,
    I don't think business rules work on parent or calculated members( though I haven't tried it), as business rules are developed using SQL stored procedures, which use the data in relational data base( fact tables), not the analysis server and fact table only has values of base members..
    if any one has tried this scenario, may be they could share more knowledge.
    Kranthi

  • Error in Validation Business Rule

    Hello Experts,
    I am trying to perform validation on Intercompany Account Receivable and Account Payable accounts. For the same I added the Validation business rule, but getting an error while trying to save and validate the business rule. The error is:
    Error = "No Data to Validate"
    I have data in these accounts that I am performing validation on. Also, I am able to save and validate the Validation Rules Table.
    Experts, could you please provide suggestions regarding why I am getting this error and how to resolve it.
    Thanks
    Rahul

    Hello,
    is this with the Product Hyperion Financial Management?
    If yes, you might close the issue here and post it in the HFM group.
    Regards,
    Philip Hulsebosch

  • Regular Expression or Common Validator Utility Class

    Hi all,
    Just to check whether is there a common validator utility class that make use of Regular Expression for input and output validation in Web Dynpro?
    Thank a lot
    Regards

    Hi
    U can make use of following classes for validating a regular expression.
    java.util.regex.Pattern
    java.util.regex.Match
    Regards
    Surender Dahiya

  • Customer Master Data - Validation / Substitution Rule

    Is there a way to perform a validation / substitution rule in the customer master data?
    Eg: In customer master, payment history checkbox is a required field so the user will always have to tick the checkbox when creating a customer master.
    Question: how to make this payment history checkbox defaulted to tick so that user don't have to manually tick it themselves when creating customer master.
    Is there a validation / substitution that can be performed in customer master because in accounting document, we will be able to perform the validation/substitution.

    Hi
    You could potentially use a BADI to substitute the data.  IMG > Financial Accounting > Accounts Receivable and Accounts Payable > Customer Accounts > Master Data > Preparations for Creating Customer Master Data > Adoption of Customer's Own Master Data Fields > Business Add-In: Customer Subscreens
    You'd need to get an ABAPer to code the change in the relevant Method.
    Kylie

  • SAP BPC 5.1 Validation Tolerance in Validation Business Rules

    I am trying to use the the validation tolerance field in the validation business rules and I make it work
    This is how i understand it:
    For example, I am trying to create a control that check that net assets = equity in the balance sheet with a tolerance of 10.
    I have set up the following validation rule header and detail:
    Header: CTRL1 ;validation operand = ; validation tolerance 10; all other fields are blank
    Details: CTRL1; account1=netassets;flow1=F_CLO;SIign1=1;account2=equity;flow2=F_CLO;sign2=1
    After running the validation package:
    If my netassets-equity=9--> i should see CTRL1=0
    If my netassets-equity=-5--> i should see CTRL1=0
    If my netassets-equity=15--> I should see CTRL1=15
    Is my understanding correct? Has anyone been able to use the validation tolerance?
    Regards
    Lena

    In addition to James comments, I just wanted to add a few additional notes:
    1.  The Demo application that was presented contains the applications that you described in your question.  Historically, the consulting team would either use the ApShell or the demo as the foundation for developing a set of applications for the customer based on the design sessions held with the customer.  BAsed on the customer requirements and design, often we start with ApShell and pull in components from the Demo that would support functionality requirements that may go beyond what Apshell has out of the box.  Many of these components are covered in an Advanced Training for BPC, including the helpful and not so helpful components.
    2.  You can pull many of the Demo dimension files, logic scripts and rules from the Application Server file folders for use in an Application set design.  Unfortunately, BPF's can not be transfered, since they are built in to an application and reside in tables in SQL. In addition, many BPF's need to be defined to meet a customers requirements, file names, location, users, and dimension structure.
    3. Many of the dimensions utilize several supporting properties that may be added via the admin console to any dimension.  The properties are a key ingrediaent to a well running application set, supporting reporting, script logic, and business rules.
    4.  The Performance dashboard is no longer an option that is included out-of -the-box, howvere it is just a shell that was adjustable to the application set designed for the customer.

  • Problems with Apache Commons Validator

    Hello there,
    I got a quiet big problem using the a.m. validation framework. When defining a validation rule for a property like this:
    <formset>
    <form name="testForm">
    <field property="firstName" depends="isEmail">
    <arg0 key="testForm.firstname"/>
    </field>
    </form>
    </formset>
    and instanciating my validator as follows:
    Validator validator = new Validator(resources, "testForm");
    validator.setParameter(Validator.BEAN_PARAM, name);
    everything works fine! I get a correct ValidatorResult object with a correct validation value.
    But as soons as I define a second Validation on the same property like this:
    <formset>
    <form name="testForm">
    <field property="firstName" depends="isEmail,isBlankOrNull">
    <arg0 key="testForm.firstname"/>
    </field>
    </form>
    </formset>
    Nothing works anymore. When iterating over the ValidatorResults object I only get one ValidatorResult object for "isEmail" with a wrong validation value. There should be two working ValidatorResult objects for "isEmail" and "isBlankOrNull"?!?!
    Are two validation method in the depends-Attribute not allowed (although it is defined in the standard)?
    You can assume, that the used validator class is conform to the given org.apache.commons.TestValidator!
    For any help, thx in advance!
    Greets
    CN

    Hey Aaron,
    Could you post your code for your <field>...</field>?
    Here is an example from: http://www.jsn-server3.com/struts-documentation/userGuide/dev_validator.html
    <field
        property="firstName" indexedListProperty="dependents"
        depends="requiredif">
      <arg0 key="dependentlistForm.firstName.label"/>
      <var>
        <var-name>field[0]</var-name>
        <var-value>lastName</var-value>
      </var>
      <var>
        <var-name>field-indexed[0]</var-name>
        <var-value>true</var-value>
      </var>
      <var>
        <var-name>field-test[0]</var-name>
        <var-value>NOTNULL</var-value>
      </var>
    </field>
    <field
        property="dob"
        indexedListProperty="dependents"
        depends="requiredif,date">
      <arg0 key="dependentlistForm.dob.label"/>
      <var>
        <var-name>field[0]</var-name>
        <var-value>lastName</var-value>
      </var>
      <var>
        <var-name>field-indexed[0]</var-name>
        <var-value>true</var-value>
      </var>
      <var>
        <var-name>field-test[0]</var-name>
        <var-value>NOTNULL</var-value>
      </var>
    </field>
    <field
        property="coverageType"
        indexedListProperty="dependents"
        depends="requiredif">
      <arg0 key="dependentlistForm.coverageType.label"/>
      <var>
        <var-name>field[0]</var-name>
        <var-value>lastName</var-value>
      </var>
      <var>
        <var-name>field-indexed[0]</var-name>
        <var-value>true</var-value>
      </var>
      <var>
        <var-name>field-test[0]</var-name>
        <var-value>NOTNULL</var-value>
      </var>
      <var>
        <var-name>field[1]</var-name>
        <var-value>insureDependents</var-value>
      </var>
      <var>
        <var-name>field-test[1]</var-name>
        <var-value>EQUAL</var-value>
      </var>
      <var>
        <var-name>field-value[1]</var-name>
        <var-value>true</var-value>
      </var>
      <var>
        <var-name>field-join</var-name>
        <var-value>AND</var-value>
      </var>
    </field>
    </form>" Which is read as follows: The firstName field is only required if the lastName field is non-null. Since field-indexed is true, it means that lastName must be a property of the same indexed field as firstName. Same thing for dob, except that we validate for date if not blank.
    The coverageType is only required if the lastName for the same indexed bean is not null, and also if the non-indexed field insureDependents is true.
    You can have an arbitrary number of fields by using the [n] syntax, the only restriction is that they must all be AND or OR, you can't mix. "
    Hope that helps,
    Nate

  • Validation - Business Rule or/and UJ_Validation

    Hi experts,
    I'm on BPC 7.5 NW, I'm facing problem to construct a simple validation where I need to compare the amount from one parent account against to other. Let's explain the business scenario and after the technical solutions.
    Business Scenario
    Compare the Total Assets is equal to the Total Liabilities. The Total Assets is represented by a parent account "1", the Total Liabilities is represented by a parent account "2". If it is different show a warning.
    This is need to trigger, after the Actual Transactional Data Load + Journals.
    Technical Solution
    Application: Legal
    Dimensions: Empresa (Entity), Conta (Account), Fonte (C_DataScr), Versao (C_Category), Groups, Intco, MesAno (Time), TipMov (Flow), CCusto (User Defined), CLucro (User Defined)   
    1 - Business Rule
    Validation Definition
    Validation Account         Remark                       Validation Operand           Other destination dimension Members                              Validation Tolerance
    ZATIVO_X_PASSIVO     Ativo x Passivo                       =                           CONTA=VALIDATIVPASS,INTCO=SPTOTAL,CLucro=ACTEDUMMY,CCusto=ACTENONE                0
    Account 1                    Flow 1                  Sign 1               Account 2                 Flow 2                       Sign 2             Remark
    1                           TMTOTAL*                  1                          2                        TMTOTAL*                    1                  Ativo x Passivo
    *The TMTotal Flow is a parent from every data on the master data TipMov (flow)
    Validation.lgf
    *RUN_PROGRAM VALIDATION
        CATEGORY = %VERSAO_SET%
        CURRENCY = %GROUPS_SET%
        TID_RA = %MESANO_SET%
        OTHER = [ENTITY=%EMPRESA_SET%]//For More than one other scope parameters: OTHER = [ENTITY=%ENTITY_SET%;INTCO=%INTCO_SET%...]
    *ENDRUN_PROGRAM
    Result
    When I run with this parameters I receive the message : "UJP_PROCESS_EXCEPTION:Data for category  not found in application LEGAL"
    2 - Validation with UJ_Validation
    Assign the driver dimension to Legal - in case I used the CONTA (Account)
    Rule Maintenance
    Assigned Member: "1" and "2"
    Use Logic Table
    Dimension = Empresa (Entity)
    Operator "="
    Members = TECSA - This is a parent from every Entities.
    Result
    When I run with this parameters I receive the message : "UJP_PROCESS_EXCEPTION:Data for category  not found in application LEGAL"
    3 - Validation with UJ_Validation and BADI
    Assign the driver dimension to Legal - in case I used the CONTA (Account)
    Rule Maintenance
    Assigned Member: "1" and "2"
    Use BAdI Implementation
    BADI_UJ_VALIDATION_RULE_LOGIC
    Create a Enhancement ZATIVO_X_PASSIVO
    Filter
    Rule_Num = 1
    APPSET_ID = ZTECSA
    DIMENSION = CONTA
    Class
    METHOD if_uj_validation_rule_logic~do_validation_logic.
      FIELD-SYMBOLS:
                       <field1> TYPE ANY,
                       <field2> TYPE ANY.
      ASSIGN COMPONENT 'FIELD1' OF STRUCTURE is_data TO <field1>.
      ASSIGN COMPONENT 'FIELD2' OF STRUCTURE is_data TO <field2>.
      IF <field1> NE <field2>.
        es_message-message = 'Error in Validation'.
        es_message-recno = 1.
        es_message-MSGTY = 'W'.
      ENDIF.
    ENDMETHOD.
    And add this line to the script
    *START_BADI_UJ_VALIDATION_RULE_LOGIC~DO_VALIDATION_LOGIC
      QUERY = ON
      WRITE = ON
    *END_BADI
    Result
    Data Region:
    [WARNING!] NO MEMBER SPECIFIED FOR DIMENSION:CCUSTO WILL QUERY ON ALL BASE MEMBERS.
    [WARNING!] NO MEMBER SPECIFIED FOR DIMENSION:CLUCRO WILL QUERY ON ALL BASE MEMBERS.
    [WARNING!] NO MEMBER SPECIFIED FOR DIMENSION:CONTA WILL QUERY ON ALL BASE MEMBERS.
    [WARNING!] NO MEMBER SPECIFIED FOR DIMENSION:FONTE WILL QUERY ON ALL BASE MEMBERS.
    [WARNING!] NO MEMBER SPECIFIED FOR DIMENSION:INTCO WILL QUERY ON ALL BASE MEMBERS.
    [WARNING!] NO MEMBER SPECIFIED FOR DIMENSION:TIPMOV WILL QUERY ON ALL BASE MEMBERS.
    [WARNING!] MEASURES IS NOT SPECIFIED!
    So what could I make to maintain all my options to do what I need ?
    I appreciate any help
    Best Regards
    Alexandre Mendoza Collepicolo

    Hi,
    Just to check, can you try and hardcode the category in the rules itself...just for a test to see if it is working.
    You can have the category mentioned as CATEGORY=ACTUAL in the rules itself for Other source dimension members and other destination members. J
    This is to check if the validation package runs successfully or not.
    Thanks,
    Sreeni

  • Country Specific Tax Registartion Validation/Check Rule

    Hi,
    Was trying to control vendor tax number registration in XK01, but rule 9 ' country-specific template' is not valid in OY17, is there where in SPRO to activate that? Or it has to be exit and logic defined there also?
    Thanks.

    Seems this solution should do but not sure if this is the only way,
    activate 'check other data' in OY17 and use Tax Code 1/2 fields, then define rules in FUGR TSRV

Maybe you are looking for

  • Airport express causes iphone and ipad to lose wifi

    We have a new (3 months old) Airport Extreme in our house.  It provides internet connectivity for an iMac, macbook pro, iphone 3gs, and ipad 2 (and a pc).  Never had any problems. Two days ago, I purchased an Airport Express to put downstairs, and wi

  • Creating a "ribbon" style menu with Muse?

    Is it possible to do a scrolling thumbnail "ribbon" in Muse? I'm trying to achieve the effect of having a small window that has several thumbnails in it that the user can scroll through to change the target. If not, how do we get that as a requested

  • Why does the Apple logo appears and disappears when I'm the iphone 4?

    When I'm using iphone 4 the Apple logo appears and disappears and appears lock screen. What to do? It' s a bug or a hardware problem?

  • Itunes automatically open when plugging in iphone

    Before installing Lion iTunes would automaticall open when I plugged in our iPhone or iPad to the Macbook. Now it does not. I have the "Open iTunes when this iPhone is connected" box checked. What next?

  • Generating URL params in XSL

    Hi I have what seems to be a very common problem, but cant find any answers. I want to build a URL based on whats in my XML, but am having trouble with escape chars etc etc. The output I want is: find.jsp?searchType=<xsl:value-of select="SearchType"/