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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T00:31:50+00:00 2026-06-06T00:31:50+00:00

I have created a registration form and now I am trying to put null

  • 0

I have created a registration form and now I am trying to put null validations on the fields.
All fields are location inside one table like :

<table border="0" cellspacing="5" width="100%">
        <tr>
            <td width="50%" valign="top">
                <span id="ctl00_PageBody_lblFname">Prénom</span>
                <strong><font color="#FF0000">*</font></strong><br />
                <input name="ctl00$PageBody$txtFname" type="text" id="ctl00_PageBody_txtFname" rel="First Name" />

                <br />

                <span id="ctl00_PageBody_lblLname">Nom</span>
                <strong><font color="#FF0000">*</font></strong><br />
                <input name="ctl00$PageBody$txtLname" type="text" id="ctl00_PageBody_txtLname" rel="Last Name" />
             </td>
         </tr>
</table>

Now using jquery I am trying to create a generic function which iterates through all the text boxes and if they are empty it displays a message mentioning the Field Name :

        var Msg = "Please provide values for :";
        var nullFieldTracked = 'false';

        $('input[type="text"], select').each(function () {
            if (this.value == '' && this.hasAttribute("rel")) {
                nullFieldTracked = 'true';
                Msg += '\n - ' + $(this).attr('rel');
            }
        });
        if (nullFieldTracked == 'true') {
            alert(Msg);
            return false;
        }

Code works like charm, I have added a ‘rel’ attribute to the textboxes in order to read the Field Name, BUT

Now there is a change in the requirement and I need to launch this website in multipul languages and hence it will read the attributes from the resource files and asp.net doesn’t create a meta resource for ‘rel’ tag, So I am thinking to reading the Field Name from the closest Span, but not able to Track.

Kindly help with Jquery.

Thanks a lot in advance.

  • 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-06T00:31:52+00:00Added an answer on June 6, 2026 at 12:31 am

    To retreive value from closest span

    $(this).prevAll("span").first().text()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to symfony. I have created a registration form using the code:
I have created Login forms and registration forms for a website. The form is
We have created a registration form in drupal 6 and used cck address field
I have created custom registration form in drupal 6. i have used changed the
I have created a user registration form in CakePHP. My intention is if user
I have created a Django app. I have a registration page(simple HTML form) in
I have created a django application. The application has a registration form. I inserted
I have created a registration form in silverlight 4, where i have a large
I have created a registration system that uses AJAX to process the form so
I have created a HTML5 Form and now on the click of the submit

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.