Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6546955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T11:46:17+00:00 2026-05-25T11:46:17+00:00

I am trying to validate two fields one is a number and other is

  • 0

I am trying to validate two fields one is a number and other is an url. At least one of this field has to have a valid value. If the number field has value and it is valid number or if the url field is present and it is a valid url the validation is passed.

I am using “requiredif” and “mask” to check this. The below is the example of the number checking,

<field property="nombre"
                 depends="requiredif,mask">
              <msg
                name="mask"
                key="errors.nombre"/>
                    <arg0 key="nombre"/>

              <msg
                name="requiredif"
                key="errors.validateNombreUrl"/>
                    <arg0 key="nombre"/>

              <var>
                <var-name>mask</var-name>
                <var-value>${nombre}</var-value>
              </var>

              <var>
                <var-name>url</var-name>
                <var-value>((url == null) and (*this* == null))</var-value>
              </var>
          </field>

In this similar manner, I am checking for the url field as well. But I see the validator validates both the field and shows up error such that BOTH fields are mandatory. How do I make it as a OR condition? I am not sure if the expression in the var value is right for requiredif, because I kind of found it works only for validwhen(which I can’t use due to version issues). How do I validated these two fields on a OR condition?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T11:46:18+00:00Added an answer on May 25, 2026 at 11:46 am

    You don’t say what Struts version you’re using, but requiredif has been deprecated since… a long time. You should be using validwhen, described here. There is an example of what you want.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to validate a phone number which is contained over two fields.
I'm trying to remote validate a field by looking at two different fields. The
I'm trying to validate a system path. This path is valid if it begins
I'm using the jQuery Validation plugin and trying to validate two time fields. I
I have been trying to validate my web page for the last two hours,
I'm trying to validate that a submitted URL doesn't already exist in the database.
I was trying to validate an XML signature. The validation according to this tutorial
I'm trying to validate a input field with the JQuery validation plugin. The numeric
I have an input db2 table with two elements: loan_number, debt_to_income; this table's name
after pulling my hair out for two days trying to figure this issue out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.