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 702737
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:45:14+00:00 2026-05-14T03:45:14+00:00

I have a table (in a form) populated with radio buttons (with a button

  • 0

I have a table (in a form) populated with radio buttons (with a button for each value in a collection). If the collection is empty, nothing shows up in the table (which is fine). (I’m using Struts2)

My trouble comes when validating that the user has selected one of these radio buttons when the submit button is clicked. I’m using JQUERY validations, and it works quite well UNLESS there are no radio buttons to select (collection is empty).

$('#startProcessForm').validate({ 
    rules: { 
        selectedProcess: {
            required: true
        } 
    }, 
    messages: { 
        selectedProcess: "Please select a process to start." 
    } 
}); 

If the list IS empty, then there are no fields (radio button or otherwise) named “selectedProcess”. So my question is this:

How can I make “selectedProcess” exist AND fail the ‘required:true’ validation if there’s nothing in the collection?

I was thinking I could create an empty tag of the same name (selectedProcess) if the collection is empty? Here’s what I’d guess would work but doesn’t seem to:

<s:if test="processes != null && !processes.isEmpty()">
    <s:iterator value="processes" status="processesStatus">
        <tr>
            <td><s:radio name="selectedProcess" list="{name}"></s:radio></td>
        </tr>
    </s:iterator>
</s:if>
<s:else>
    <tr>
        <td><a name="selectedProcess"></a></td>
    </tr>
</s:else>

Thanks!

  • 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-14T03:45:14+00:00Added an answer on May 14, 2026 at 3:45 am

    you could do <input type="hidden" name="selectedProcess" value="-1"> if there are no values (instead of your <a name>)

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

Sidebar

Related Questions

I have a table inside a form, which is populated with various input boxes.
I have a table with multiple rows. Each row is a form. I want
I have a data table which is populated with data unrelated to drupal content
I have populated an html form with MySQL data from a table. I have
I have an HTML form being populated by a table of customer requests. The
i have a drop down list which is populated dynamically from database table i.e
I am working on dynamic form. i have a radio button, if a user
So, I have a customer table, containing customer records, record, each of which has
I have a CGI page with a table which is populated by fetching the
I have made a simple table form here in jsfiddle . I also put

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.