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

custom control an javascript

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

    custom control an javascript

    How can I add javascript to the oncklick-event of a custom control?
    Cannot find an example anywhere...
    Thanks for help,
    Dietmar

    #2
    Re: custom control an javascript

    There's a property section named Custom Control Properties. In there, get into Definitions. Once in there you'll see, highlighted in yellow (thanks to Alpha - they're so good to us), the section you need to put your HTML code in. Here's a little sample that works well to create a button with an onClick event on it. What do you want to do in the onClick?

    Code:
    <script type="text/javascript">
     function copyText()
    {
    alert('hi there');
    }
    </script>
    <button onclick="copyText()">Copy Text</button>

    Comment


      #3
      Re: custom control an javascript

      I have this in the onDblClick-event of a label control and want to do exactly the same in the custom control:
      when dblclick on the cell, set a variable and execute an action button.

      window['WelcheNummer'] = {Grid.RowNumber};
      var myPointer = {grid.componentName}_BUTTONS_KURZANZEIGE;
      myPointer.onClick();

      Comment


        #4
        Re: custom control an javascript

        Seems to be the right direction.
        But the problem I get is: if I put this code in the custom control it is working find in working preview.
        But when I put the grid on the a5w page, the javascript function is not executed when the button is clicked. Still it can be seen in firebug.
        Any idea?

        Comment


          #5
          Re: custom control an javascript

          Not sure... but it's working here.

          I added a field to my grid (it was a textbox field, by default) and I changed it to a Custom Control field.

          In the Custom Control Properties Definition I put...

          Code:
          <script type="text/javascript">
           function setWinVar()
          {
          var rowNum = {Grid.Object}._selectedRow;
          window['WelcheNummer'] = rowNum;
          var myPointer = {grid.componentName}_BUTTONS_KURZANZEIGE;
          myPointer.onClick();
          
          }
          </script>
          <label ondblclick="setWinVar()">Set Win Var and run Action Button</label>
          This code goes between the %html% tags.

          I created an Action button with the same name as yours. My action button just puts out an alert showing the window var.

          You'll notice that you can't use {Grid.RowNumber} in this case... you must use what's above in the code.

          I put this grid into an A5W page and all is well.

          The Custom Control Definition creates a label field, but you can create anything you want... you mentioned a label field... and it's running off an ondblclick event.
          Last edited by Davidk; 07-25-2012, 12:01 PM.

          Comment


            #6
            Re: custom control an javascript

            As soon as I publish the page with the grid to the localhost I get this in firebug:
            ReferenceError: setWinVar is not defined

            But there migth be a completly different approach to solve my basic problem:
            I have a row-event that is fine in 5 of 7 cells. The two other cells show an image which has an event of its own. When I click on the image, its own event fires (which is ok) AND the row event fires (which I don't want in this case). Can I do anything to stop the row event?
            I already opened a new thread with this question, but no answer so far.
            Again, many thanks for your ideas!

            Comment


              #7
              Re: custom control an javascript

              btw...should be myPointer.click();

              Comment


                #8
                Re: custom control an javascript

                I found this one in a more sophisticated a5-sample, wich show how to use a pointer-var:
                onClick() calls the onclick-event.

                var myPointer = {grid.componentName}_BUTTONS_KURZANZEIGE;
                myPointer.setDisabled(true/false)
                myPointer.setDisplay(true/false)
                myPointer.html = 'New Button Text'
                myPointer.onClick = function() {alert('now say hello');}
                myPointer.layout = 'icon text';
                myPointer.icon = 'images/$$application.alpha.png.a5image';
                myPointer.refresh();


                onClick()

                Comment


                  #9
                  Re: custom control an javascript

                  Hey Andy... you'd think so, but myPointer.click(); throws an error and myPoint.onClick(); doesn't.

                  Comment


                    #10
                    Re: custom control an javascript

                    oh, sorry, you're correct - i misread that it was the a5 element method being called.

                    Comment

                    Working...
                    X