Re: Quickform - clientside disabling of form elements
| From: | Bertrand Mansion | Date: | Tue, 27 May 2003 13:35:17 +0000 |
| Subject: | Re: Quickform - clientside disabling of form elements | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-5616@lists.php.net to get a copy of this message | ||
<sfisk@quantiv.com> wrote :
>> That's javascript. Just add a javascript disabler function into your
> template or as a >static element. If the function is called 'disableDate()',
> then add an 'onclick' => >'disableDate()' attribute to your radio
> element:
>
>> $radio =& HTML_QuickForm::createElement('radio', 'current', null,
> array('onclick' => >'disableDate();'));
>
>> In disableDate(), you need to check if the radio is checked or not and
> accordingly >disable the date element. Elements in forms have properties
> that can be accessed with >javascript, check them out to see which one you
> have to change. I am not sure onclick >is the right event to call though.
>
> Hi there
>
> I'd kind of got to that point already - I'm having trouble because the
> select boxes for the dates are an array of values in Javascript - I can't
> seem to get at the array of values to say:
>
> document.entryForm.dateStopped.d.disabled = true
>
> This has no effect on the form at all.
>
> I know this is seeming to ask about JavaScript and not php but anybody done
> this? I can't seem to do it because I don't know how quickform was designed
> to work with JavaScript.
Form element name like date[Y] is valid javascript and is by no way
considered as an array in javascript. Just think about them as is they were
a string because [ and ] are accepted in javascript variable names just like
underscores.
HTH
Bertrand Mansion
Mamasam