OK, I think I may be on to something here...

In this particular Action, I am working with a Payment class, instead of individual fields. that may very well be where all of my trouble is.

<s:form namespace="/irmc" action="Payment_retrieveFee" validate="true">
<s:textfield key="payment.amtToPay" "/>
<s:textfield key="payment.ccNumber"/>
<s:textfield key="payment.ccExpDate"/>
<s:textfield key="payment.payorCity"  />
<s:textfield key="payment.payorState"  />
<s:textfield key="payment.payorZipCode" />
<s:submit align="center" label="button.label.submit"/><s:reset align="center"/>
</s:form>

So say I want to validate the ccNumber and ccExpDate. These are part of my Payment, so how do I go about validating them? Let's assume for now that the AccountAction class has a method called doRetrieveFee() and my validation file should in fact be called AccountAction-doRetrieveFee-validation.xml

My AcccountAction works with the complete payment as such:
   /**
    * @param payment
    *            The payment to set.
    */
   public void setPayment(PaymentBean payment) {
       this.payment = payment;
   }

   /**
    * @return Returns the payment.
    */
   public PaymentBean getPayment() {
       return payment;
   }

So in my validator I have tried a couple variations on a theme. Does anyone see what I need to change or modify to get some validation happening?

<!DOCTYPE validators PUBLIC
       "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
       "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd";>

<validators>
   <field name="ccNumber">
       <field-validator type="requiredstring">
           <message key="requiredstring"/>
       </field-validator>
   </field>
   <field name="payment.ccNumber">
       <field-validator type="requiredstring">
           <message key="requiredstring"/>
       </field-validator>
   </field>
   <field name="payment.ccExpDate">
       <field-validator type="requiredstring">
           <message key="requiredstring"/>
       </field-validator>
       <field-validator type="stringlength">
         <param name="minlength">4</param>
         <param name="maxlength">4</param>
         <message key="expDateLength"/>
       </field-validator>
   </field>
</validators>




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to