Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #22258

Re: managing buttons

Newsgroups comp.lang.javascript
Subject Re: managing buttons
From "Evertjan." <exjxw.hannivoort@interxnl.net>
References <l81j4h$7n4$1@shakotay.alphanet.ch> <l81r43$ens$1@dont-email.me>
Message-ID <XnsA290B2B281B3eejj99@194.109.133.246> (permalink)
Date 2013-12-08 16:34 +0000

Show all headers | View raw


Norman Peelman wrote on 08 dec 2013 in comp.lang.javascript:

> On 12/08/2013 05:54 AM, Une Bévue wrote:
>> on my page i have 10 buttons
>>
>> 5 for categories :
>> "+", "-", "E", "S", "C" for Add, Remove, Edit, Save and Cancel
>>
>> the same buttons for items.
>>
>> I'm looking for clever idaes on how to manage those buttons.
>>
>> I know how to enbale/disable the buttons but i'm confused on how to 
have
>> a clean and clever way to manage them versus the state of my JS.
>>
>> For example when I'm editing a category or an item, after having click
>> on "E", i want to disable "+", "-" and "E", letting "S" and "C" 
enabled.
>>
>> Also my "S" button serves two purposes : saving an updated 
category/item
>> or saving a modifies category/item
>>
>> Any help appreciated.
> 
>    So create functions that will enable and disable a passed array of 
> objects (control names) such as:
> 
> 
> function ButtonsDisable(buttons)
> {
>    foreach (buttons as button)
>    {
>      obj = document.getElementByID(button)
>      obj.disabled = true
>    }
>}
> 
> function ButtonsEnable(buttons)
> {
>    foreach (buttons as button)
>    {
>      obj = document.getElementByID(button)
>      obj.disabled = false
>    }
>}
> 
> So that up entering the code for *Edit*ing you would call the functions 
> like:
> 
> ButtonsDisable(array("+","-","E"))
> ButtonsEnable(array("S","C"))
> 
> 
>    Off the cuff code, may need tweaking but that's the general idea. So 
> I'm guessing that if 'categories' or 'items' is empty you would:
> 
> ButtonsDisable(array("-","E","S","C"))
> ButtonsEnable(array("+"))

Nice idea, 
except that an id should start with a letter,
and cannot contain a +.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

managing buttons Une Bévue <unbewusst.sein@fai.invalid> - 2013-12-08 11:54 +0100
  Re: managing buttons Norman Peelman <npeelman@cfl.rr.com> - 2013-12-08 08:10 -0500
    Re: managing buttons Une Bévue <unbewusst.sein@fai.invalid> - 2013-12-08 15:03 +0100
    Re: managing buttons "Evertjan." <exjxw.hannivoort@interxnl.net> - 2013-12-08 16:34 +0000
      Re: managing buttons Denis McMahon <denismfmcmahon@gmail.com> - 2013-12-08 20:12 +0000
      Re: managing buttons Norman Peelman <npeelman@cfl.rr.com> - 2013-12-08 17:59 -0500
        Re: managing buttons Une Bévue <unbewusst.sein@fai.invalid> - 2013-12-09 07:02 +0100
      Re: managing buttons Une Bévue <unbewusst.sein@fai.invalid> - 2013-12-09 06:24 +0100
        Re: managing buttons "Evertjan." <exjxw.hannivoort@interxnl.net> - 2013-12-09 20:34 +0000
          Re: managing buttons Norman Peelman <npeelman@cfl.rr.com> - 2013-12-09 23:05 -0500
            Re: managing buttons "Evertjan." <exjxw.hannivoort@interxnl.net> - 2013-12-10 08:55 +0000
              Re: managing buttons Norman Peelman <npeelman@cfl.rr.com> - 2013-12-10 07:07 -0500
    Re: managing buttons Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-12-08 19:35 +0100
      Re: managing buttons Une Bévue <unbewusst.sein@fai.invalid> - 2013-12-09 06:26 +0100

csiph-web