www.webdeveloper.com
Results 1 to 4 of 4

Thread: Validation for Text box Array

  1. #1
    Join Date
    Apr 2010
    Posts
    52

    Validation for Text box Array

    I have these test boxes mentioned below with the array sign I want to check for a validation for these text boxes for an integer value.... how can I do it...
    I know how to do it for the normal one's but how to do for the one's with array[] symbol...

    Have pasted the one i am already using for the normal ones'





    <tbody>
    <tr>
    <td width="120"><input type="text" name="Interface_Name[]" size="15" /></td>
    <td width="60"><input type="text" name="Port_Index[]" size="4" /></td>
    <td width="60"><input type="text" name="SBB_Index[]" size="4" /></td>
    <td width="120"><select name="Connect_Type[]" ><option selected >-Select-</option>
    {html_options options=$lstConType}</select></td>
    <td width="60"><select name="Port_Status[]" ><option selected >-Select-</option>
    {html_options options=$lstStatus}</select></td>
    <td width="24"><a href="JavaScript: deleteLRU({$lstRows[lRow].LRU_PartNumber});"><img src="images/icon_del.gif" width="12" height="12" alt="Delete LRU" /></a></td>
    </tr>
    </tbody>


    var oFrm = document.FrmAdd;
    function Chkvalidate()
    {

    if(!chkText(oFrm.txtName, " Name Field is empty")) return false;
    if(!chkText(oFrm.txtRefNumber,"Ref Number Field is empty")) return false;




    return true;
    }

  2. #2
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    Code:
    document.formName.elements['Interface_Name[]']

  3. #3
    Join Date
    Mar 2010
    Posts
    2,803
    I am assuming you have other elements with each respective name elsewhere in your code otherwise you can name the textboxes without the [].

    Anyway, you can use

    Code:
     
    var myTextboxes = document.getElementsByName("txtInput[]");
    to get an array of the textboxes for a given name and then you loop through each element in the array myTextboxes and validate it for whatever you need to check.

  4. #4
    Join Date
    Apr 2010
    Posts
    52
    thnz tirna i am actually looking for the code of tht loop only............. can u help me with tht

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles