Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

check a box with button onclick event on a UX

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    check a box with button onclick event on a UX

    A checkbox control based on a variable with multiple choices. Trying to check two of the 5 boxes with a button's onclick event.

    {dialog.object}.setValue('checkboxes[]',['checkbox1','checkbox2'],true);

    This is not working. What am I missing?

    #2
    Re: check a box with button onclick event on a UX

    Probably fun with case sensitivity. Try this:

    {dialog.Object}.setValue('CHECKBOXES[]',['checkbox1','checkbox2']);

    I think the control reference must be in all uppercase - regardless of the case management in you actual control name. And the choices you're trying to set must match, so if your choice is Checkbox1 and you specify checkbox1 it won't work.
    -Steve
    sigpic

    Comment


      #3
      Re: check a box with button onclick event on a UX

      Thank you Steve,
      I'll give it a try at halftime!
      Game Over! Great half time show, but that was about it. lol

      Back to business:
      The checkboxes are case sensitive so they need to be exact. The control name seems to work either way, however keeping it in caps rings some bells as being a best practice. Not positive about that however.

      This effort to manipulate checkboxes was in order to manipulate security groups dynamically for a user in my app.
      I started with the UX security template to edit a user, and tried to get to the userroles control to accomplish this programatically.

      {dialog.Object}.setValue('CHECKBOXES[]',['checkbox1','checkbox2']); worked on a checkbox control with a static list, however it did not work in the template with the checkbox being populated by security groups and set as checked according to the current users group assignment. Well it did create some erratic behavior it cleared the check mark of any checked groups.


      Since the template uses action scripting it has been difficult to understand. I did manage a work around however. Once I understood how to use setValue with a checkbox array.

      I manually populated the control choices with e.rtc.UserRoles = comma_to_crlf("group1,group2") vs a5ws_GetGroupsDialog()
      This populated the control choices variable UserRoles with the specific groups I needed.

      I converted the ondialoginitialize ExecuteServerSideAction("Populate Dialog from Tables::LoadUser") to xbasic

      I then removed:

      groups=[UserRoles] from the rtc.fieldmap. So although group1, and group2 are checkbox chioces populated with the UserRoles variable they are not selected,although in this scenario group one would have been checked when populated by the template because these users are all assigned to group1.

      I then put {dialog.Object}.setValue('UserRoles[]',['group1','group2']); in a on focus event of another textbox field in the control group that I know will be populated by the user. This checks the two boxes.

      Why two groups? I already know that these users are a member of group1, and need to be added to group2. However validating and saving the security groups clears any existing assignments in security. I am not sure exactly why this is because I do not know how to expose, or am not recognizing the code that handles this. So again as a work around I just reassign both groups.

      Now last problem, I need this to be invisible to the user. However I can't make the control hidden as far as I know because that only applies to a textbox field. So I just hide the row, and the label.

      This works but doesn't seem secure to me at all. This is the work of a challenged, but determined programmer!
      I would like to understand this fully, since it is a frequent requirement of my app.

      for now it works
      Second group assigned: Check!

      Bob
      Last edited by bob9145; 02-08-2016, 01:05 AM.

      Comment


        #4
        Re: check a box with button onclick event on a UX

        This works on a checkbox control named 'checkedbox1' a stored value and a display value. Here, the stored value is used to check 2 of the checkboxes in the control.

        Code:
        {dialog.object}.setValue('checkbox1[]',['1','2'],true);

        Comment


          #5
          Re: check a box with button onclick event on a UX

          OK, now I have one that won't work. Anyone see a problem with this?

          Code:
          {dialog.Object}.setValue('Property_Type_Ckboxes[]',['Hotel - Office','Office for sale - Office']);
          Yes, the values match the choices in the controls just fine.

          Thanks.
          -Steve
          sigpic

          Comment


            #6
            Re: check a box with button onclick event on a UX

            You don't say if you have both a Display Value and Stored Value set for this checkbox. If just a Display Value, then your .setValue works... since the stored valued is the same as the display value.

            If you have a Stored Value that is the same as your Display Value, then the setValue works.

            If you have a Stored Value that is different than the Display Value, then you must supply the Stored Value in the .setValue method.

            Comment


              #7
              Re: check a box with button onclick event on a UX

              Looks correct, using that exactly working for me in a onFocus event. Where are you using it?

              Comment


                #8
                Re: check a box with button onclick event on a UX

                Single value David. Not a separate stored value.

                Bob - I'm applying this from a callback. But to debug, I put it right on a test button. Still no joy.
                -Steve
                sigpic

                Comment


                  #9
                  Re: check a box with button onclick event on a UX

                  There must be something else going on that you've not detailed here. The same javascript from both client and server side work.
                  Attached Files

                  Comment


                    #10
                    Re: check a box with button onclick event on a UX

                    Only difference might be that the checkbox list is populated dynamically from a table.

                    And yup, I just build a test with static values, then applied this, and it worked just fine.

                    So, it appears the difference is that it won't work if the checkbox choices is populated from a table? Makes no sense.

                    Wait - I think I have it. My population query is now this, that appears to work.

                    Code:
                    SELECT rtrim(concat(rtrim(Description), ' - ', Type)) FROM Property_Types ORDER BY Description
                    I had this:

                    Code:
                    SELECT concat(rtrim(Description), ' - ', Type) FROM Property_Types ORDER BY Description
                    Lemme plug this into the bigger project, see how it flies.
                    Last edited by Steve Workings; 02-21-2016, 05:52 PM.
                    -Steve
                    sigpic

                    Comment


                      #11
                      Re: check a box with button onclick event on a UX

                      My tests were with Static and Dynamic SQL selections. The only part that was unknown was how your sql statement was put together. Both of your SELECT statements work on my data. The only issue would be if your table values had extraneous spaces in them... which would have shown up in the displayed checkbox selections... and would explain why your .setValue wouldn't work. Fixing your data, as in your 2nd SELECT, allows the .setValue to find a match.

                      Comment


                        #12
                        Re: check a box with button onclick event on a UX

                        Yup, rtrim() on the expression did the job. What I also discovered was that customer's SQL 2008 is handling that differently than my SQL 2012. Love my job.
                        -Steve
                        sigpic

                        Comment

                        Working...
                        X