DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Form arrays in javascript

  1. #1
    Join Date
    Feb 2007
    Posts
    79

    Form arrays in javascript

    Why wont this work? checkFields() iF statment is failing. The select must be set to multiple. Thanks.

    Code:
    <form method="POST" action="" name="this_form" onSubmit="return checkFields();">
    	<select name="this_select[]" multiple>
    		<option value="ts1">ts1</option>
    		<option value="ts2">ts2</option>
    		<option value="ts3">ts3</option>
    		<option value="ts4">ts4</option>
    	</select>
    </form>

    Code:
    <script language="Javascript">
    <!--
    function checkFields(){
    	var errormsg = "";
    	if (document.this_form.this_select.value == "") { var errormsg = errormsg + "Please Select an Value.\n\r"; }
    	if (errormsg != "") { alert(errormsg); return false; }
    }
    //-->
    </script>
    Last edited by cesarcesar; 06-05-2007 at 04:16 AM.

  2. #2
    Join Date
    Feb 2007
    Posts
    79
    solution:
    Code:
    document.this_form.elements['this_select[]'].value

Similar Threads

  1. A form passing a parameter to another form
    By Bill Gaddam in forum VB Classic
    Replies: 10
    Last Post: 11-06-2007, 12:15 PM
  2. Replies: 1
    Last Post: 08-23-2006, 02:11 AM
  3. pass two javascript form funtions - help
    By sccusandy in forum Java
    Replies: 2
    Last Post: 05-18-2006, 11:22 AM
  4. I am helpless - Edit Info form
    By Dan in forum VB Classic
    Replies: 0
    Last Post: 03-17-2000, 06:14 AM
  5. Losing control on SetParented form.
    By Mark Alexander Bertenshaw in forum VB Classic
    Replies: 0
    Last Post: 03-16-2000, 01:14 PM

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
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center