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

  • Home
  • SEARCH
  • 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 8805749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:56:44+00:00 2026-06-14T01:56:44+00:00

This problem came to me today. I’m working in a web-based (Struts 2) project

  • 0

This problem came to me today. I’m working in a web-based (Struts 2) project with lots of JSPs, and most of input, select, table and a elements are defined with only with the name attribute, no id set, such as:

<input name="myname" class="myclass" value="" type="text"/>

So far so good, except that unfortunately there’s a lot of javascript validation for those fields, and as far as I could read the code before leaving most of them actually refer to the elements with document.getElementById.

The catch here is that this is an old application (not that much old actually) only compatible with IE-6 and IE-7 (I didn’t searched the net in order to understand how IE actually seems to find the element only with the name attribute, but I guess it must do something). No surprise every other single browser complains and cries.

So, I’m trying to come up with a simple solution: look up all JSPs that defines input, select, table and a elements with the name attribute but not id in order to fix the HTML.

Using my good ol’ friend http://rubular.com I came up with the following:

/<(?:(input|select|a|table))\s+((?!id).)*>

This will catch every referred element without id. But how can I actually assert that only those with name are matched?

Oh, another important point. The definition of the elements are in a single line, so it’s most probable that there arent’t such things as:

<input name="..."
       class="..."/>
  • 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-06-14T01:56:46+00:00Added an answer on June 14, 2026 at 1:56 am

    Try this:

    <(?:input|select|a|table)\s+(?=[^>]*\bname\s*=)(?![^>]*\bid\s*=)[^>]*>

    Explanation:

    <                           "<"
    (?:input|select|a|table)    One of "input", "select", "a", "table"
    \s+                         Whitespace
    (?=                         Positive lookahead
    [^>]*                           Anything up to but excluding ">"
    \b                              Word boundary
    name                            "name"
    \s*                             Possible whitespace
    =                               "="
    )
    (?!                         Negative lookahead
    [^>]*                           Anything up to but excluding ">"
    \b                              Word boundary
    id                              "id"
    \s*                             Possible whitespace
    =                               "="
    )
    [^>]*                       Anything up to but excluding ">"
    >                           ">"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Problem This question actually came up at work today. We are planning an experiment
I came across this problem when I want to check what I input is
I came to work today and i found my hudson with this problem! I've
I came across this problem via a colleague today. He had a design for
I was practicing SRM Problems in Topcoder.I came across this problem Problem Statement: Today
I was thinking about this problem today, and I came with the following pseudocode
I don't have much experience with QT and this problem came out today. QList<int>
Today I came across this problem in javascript and do not know why it
Today I came across a new problem. As most of you probably already know,
I came across this problem when trying to decode json into an array ,

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.