Re: QuickForm: Problem enabeling and disabeling Date fields with Javascript

From: Date: Thu, 10 Feb 2005 08:28:24 +0000
Subject: Re: QuickForm: Problem enabeling and disabeling Date fields with Javascript
References: 1 2 3  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-17471@lists.php.net to get a copy of this message
This seems to work fine in IE. If you don't like javascript indexing like wform[0], wform[1],wfrom[2] instead of from[d], from[m],from[y], you can give IDs to your selects and use getElementById to get your selects. Good luck, Valeriy Krizhevich. Try to generate something like this (I never used Quickform, so I write it by my hands): <!doctype html public "-//W3C//DTD HTML 4.0//EN"> <html> <head> <title>from</title> </head> <body> <pre> <?php //from.php print_r($_REQUEST); ?> </pre> <form action='from.php' method='get' name='wform'> <select name="from[d]"> <option value="1">01</option> </select> <select name="from[m]"> <option value="1">02</option> </select> <select name="from[y]"> <option value="1">03</option> </select> <!--LOOK AT THIS--> <input type='button' name='toggle' value='tOGGLe' onclick='alert(window.wform[0].name);window.wform[0].disabled=!window.wform[ 0].disabled;/*toggles form[d]*/'> <input type='submit' value='Go!'> </form> </body> </html> > > Hello! > > > > I think javascript allows only A-Za-z0-9_ in document elements' names just > > like in variables. > > > > Frustratingly, PHP requires invalid form field names if you want the info to > end up in an array. This JavaScript syntax seems to work ok, though: > > var field = document.forms['form_name']['field_name'] > > Best, > Nick. > > ------------------------------- > Nick Nettleton > web: www.plumdigitalmedia.com > > -- > PEAR General Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.pear.general (#17471) next »