Results 1 to 2 of 2

Thread: How to identify duplicate form elements with same name in a funcation????

  1. #1
    Expert Member
    Join Date
    May 2009
    Answers
    1,374

    How to identify duplicate form elements with same name in a funcation????

    Hi guys,

    I have multiple price and quantity fields and their total ( price * quantity) in a loop with same form name and I want to calculate the total in each row with onChange event.


    Since they have same name how do I identify the exact fields. Please see example and give me a hint on how I can grab the exact changed field to calculate the corresponding total.


    The grand total field is outside the loop and would be the sum of all totals

    %
    for (i=0; i<5; i++)
    {
    %>



    <% } %>


    Pls guide me to correct this.

    Thanks,
    Riju.


  2. #2
    Junior Member
    Join Date
    Jun 2009
    Answers
    3

    Smile Re: How to identify duplicate form elements with same name in a funcation????

    Hi,

    When you name/id two or more HTML elements with the same name/identifier, the corresponding JavaScript objects are put into an array of that name, so they can be handled as a group. Why use the same names? Only a few types of elements are designed to be used in groups (radio buttons, e.g.). Identifiers should be unique.



    Karthik


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact