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


Groups > comp.lang.javascript > #22264

Re: managing buttons

From Norman Peelman <npeelman@cfl.rr.com>
Newsgroups comp.lang.javascript
Subject Re: managing buttons
Date 2013-12-08 17:59 -0500
Organization A noiseless patient Spider
Message-ID <l82tkr$2m5$1@dont-email.me> (permalink)
References <l81j4h$7n4$1@shakotay.alphanet.ch> <l81r43$ens$1@dont-email.me> <XnsA290B2B281B3eejj99@194.109.133.246>

Show all headers | View raw


On 12/08/2013 11:34 AM, Evertjan. wrote:
> 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 +.
>

   Again, off the cuff code to get the idea out to the OP. I'm sure they 
would have figured that out. If not, they'd be back.


-- 
Norman
Registered Linux user #461062
AMD64X2 6400+ Ubuntu 10.04 64bit

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