6 Replies Latest reply on Jul 25, 2009 1:07 PM by JurrasicParc

    Getting a button name

    JurrasicParc

      Title

      Getting a button name

      Post

      Hi,

       

      A have a field which act as a button; when I click it, it starts a script which sets the underlining field value. 

      Since I have about 50 copy of this field on the page I want to pass the field name as a script parameter. If I use the Get(ActiveFieldName) function it return empty, I guess since clicking on field associated with a button action does not activate the field.

      Does anyone have a solution ?

      Thank's in advance

        • 1. Re: Getting a button name
          comment_1
            

          JurrasicParc wrote:
          clicking on field associated with a button action does not activate the field.

          That is correct. Why do you need 50 copies of the same field?


          • 2. Re: Getting a button name
            JurrasicParc
              

            Actually it's not 50 time the same field. I keep record of helath care activity with an "activity" record; activity is recorded 4 times a day (6 hours period) and there are about 50 different activity types to record. For every 6 hours a record is created for every type of activity even if no activity is performed, this is done for legal reason, for tracing activity (no activity is as important as a defined activity).

            Thus on a activity model, the user has access to one day of recording, that is in fact 4 x 50 record (they can view a full week of activity in read only mode). So every record is identical in structure but not in content.

            When the user click (shift-clik or ctrl-click) on one the record field it memorizes the type of activity performed, a timestamp and the username.

            I would just like to avoid setting 200 buttons which finally call the same scrip, especially if later-on the DB name or the field name changes.

            • 3. Re: Getting a button name
              comment_1
                

              JurrasicParc wrote:

              the user has access to one day of recording, that is in fact 4 x 50 record


              I believe there's your solution - make it 4x50 records in fact, and place them in a portal (or portals). Then you'll only need one button, and changing the field's name won't be a problem.

               

              It will likely solve other issues as well, since 50 fields to record essentially the same thing is not a good structure.


              • 4. Re: Getting a button name
                JurrasicParc
                   I currently test with just one record but finally it will be indeed either 4 x 50 records or 4 records with field "duplicated" 50 times (Field_A1, Field_B2...  Field_A2, Field_B2...). Let say "Field_Bx"  act as a button and when the user clic on it I need to pass some identification to the script so that it work on the correct related fields (with the x extension); so one button will no do (at least as I understand).
                • 5. Re: Getting a button name
                  comment_1
                    

                  JurrasicParc wrote:
                  finally it will be indeed either 4 x 50 records or 4 records with field "duplicated" 50 times (Field_A1, Field_B2...  Field_A2, Field_B2...).

                  There is a big difference between the two. As a rule of thumb, any time you find yourself numbering fields in this fashion, it's an indication you should be using records in a related table instead (read up on data normalization, esp. 1NF, to learn more).

                   

                  It may seem that since your record will ALWAYS contain 4x50 items, there's no need to split them off to separate child records. However, that's not so: you will be severely limited in your reporting capabilities if you don't (for example, you won't be able to group activitites by their time slot). And, of course, doing so will solve your current predicament.


                  • 6. Re: Getting a button name
                    JurrasicParc
                       Thanks, that's a good idea, I don't know why I did'nt thought about it un this case, I'll give it a try