[dokuwiki] Re: Plugin form

  • From: "Martin Tschofen" <martin.tschofen@xxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Tue, 25 Mar 2008 21:53:20 -0500

Sounds like a UI question. You want to do this after DW has rendered the
html page.
Looks like you will need to write some JavaScript that uses the Event
functions already in DW to listen to changes made to your checkboxes and
restrict it accordingly.

A quick outline:
I'd suggest you attach a class to an html element (form, div) that wraps
around the checkboxes when DW renders the page. Based on your plugin syntax
it could be 'Only3Selected'.

You'll need at least two JavaScript functions:
One that attaches events to all your checkbox groups.
A second that processes user interaction.
Use the 'addInitEvent(initfunctionName);' in your script.js to call the init
function that finds all html elements with that class and attaches an event
(onChange, OnMouseUp...) to them.
When the user triggers that event it calls the second javascript function to
control the selection options of your checkboxes.

Hopefully this makes sense and gets you started. Don't forget to look at the
javascript pages on the DW site...martin




On Tue, Mar 25, 2008 at 11:31 AM, Syv Ritch <elfroggio@xxxxxxxxx> wrote:

> Hi,
>
> Is there a way of presenting a form with a dozen of options as check
> marks and make sure that only 3 of them are used:
>
> <FORM WHICH_SELECT>
> Checkbox Sele01 "Do you want to use the xxx" 0;
> Checkbox Sele02 "Do you want to use the xxx" 0;
> Checkbox Sele03 "Do you want to use the xxx" 0;
> Checkbox Sele04 "Do you want to use the xxx" 0;
> Checkbox Sele05 "Do you want to use the xxx" 0;
> Checkbox Sele06 "Do you want to use the xxx" 0;
> Line;
> Constraint Only3Selected
> Buttons "proceed" "clear" 90;
> </FORM>
>
> How can I do the constraint: Only 3 items can be selected?
>
> Thanks
> --
> DokuWiki mailing list - more info at
> http://wiki.splitbrain.org/wiki:mailinglist
>

Other related posts: