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

Hide 'New Record' conditional Statement

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

    Hide 'New Record' conditional Statement

    Im not sure why Alpha does not implement server side hides for their Add New Record link, as well as Edit functionality.

    This is a common asking in most web applications.
    Example:
    Transactions in COMPLETE status are not editable
    Item in X status is not EDITABLE

    Cannot Insert Child Rows if Parent Row Status = COMPLETE.

    For example: I have an Item Table, and an Item Attachments table. If item.status is not "INC" then no more attachments are allowed.
    However, the user can still Expand the Row Expander, and click 'Add Attachments'. I would like to hide the 'Add Attachments' in the child grid if the parent status is INC.

    I can get the parent status into the child grid if necessary, but there seems to be no way to hide the New Record link based on conditional logic.

    Example:
    I expand Item ID 19 in PEND status.
    The child grid needs to hide the New Record.

    I know how to force this constraint however,
    the user can click
    Add Attachment>(Gets a detail view popup)>DOes some data entry>Attempts to Save>'Were sorry you cannot add attachments to this task'

    Users get upset/angry at this scenario. If theyre not allowed to Add Attachments, I should hide the Add Attachments link.

    Has any1 successfully been able to do this?
    Last edited by aburningflame; 06-20-2012, 06:01 PM.
    Scott Moniz - Computer Programmer/Analyst
    REA Inc.
    http://reainc.net
    (416)-533-3777
    [email protected]

    REA INC offers consulting services, programming services, systems design, database design, third party payment gateway integration (CHASE, PAYPAL, AUTHORIZE.NET) and developer support.
    If you need custom code, or 1-to-1 mentoring in any facet of your database/web application design,
    contact us to discuss options.

    #2
    Re: Hide 'New Record' conditional Statement

    Hey Scott,

    I get what you're trying to do, but could you post a couple of quick pics... just want to make sure I've got it right.

    Comment


      #3
      I did something like this in one of my apps. Let me take a look tomorrow, as I can't remember off the top off my head what I did. I just know I spent a long time trying to figure it out.
      Stephen Pilon
      Associate Librarian
      Christendom College

      Comment


        #4
        Re: Hide 'New Record' conditional Statement

        I'm not 100% on what you are trying to achieve but it sounds like you can make your child grid read-only and then include your own conditionally displayed ADD button with a detail pop-up grid (new record).
        Thanks,

        Roderick Silva
        [email protected]

        About Me: rodericksilva.com
        Twitter: rodericksilva

        Comment


          #5
          Re: Hide 'New Record' conditional Statement

          I think it's just a matter of getting at the right ID for the Add and then using javascript to disable it. But, I'd like to see it before I could say for sure.

          Comment


            #6
            Re: Hide 'New Record' conditional Statement

            I think it's just a matter of getting at the right ID for the Add and then using javascript to disable it. But, I'd like to see it before I could say for sure. - I realize there are ways to do this, but why isnt there something like this server-side that stops the Add Record from rendering. This is common in a lot of applications and most grids do have this functionality (check out devexpress grids for asp.net). There should be a server side way to disable edits, disable row edits, etc. Example: On row render you should be able to do this

            e.EnableRowEdit=.f.


            On Grid Render you should be able to do this:
            e.EnableAddRecords=.f.

            The problem with alpha is that everythings hidden and the documentation isnt really in depth.
            For example, you can browse the xbasic and see there is a e.tmpl.DetailView.allow_update / allow_insert / allow_delete.

            Ive tried setting these and the must recalculate flag, but still no luck.
            There are no good examples of doing any of this 'advanced' stuff.

            :/ So I always feel lost and in the weeds when it comes to these sort of things.
            Scott Moniz - Computer Programmer/Analyst
            REA Inc.
            http://reainc.net
            (416)-533-3777
            [email protected]

            REA INC offers consulting services, programming services, systems design, database design, third party payment gateway integration (CHASE, PAYPAL, AUTHORIZE.NET) and developer support.
            If you need custom code, or 1-to-1 mentoring in any facet of your database/web application design,
            contact us to discuss options.

            Comment


              #7
              Re: Hide 'New Record' conditional Statement

              Originally posted by StephenP View Post
              I did something like this in one of my apps. Let me take a look tomorrow, as I can't remember off the top off my head what I did. I just know I spent a long time trying to figure it out.
              Would love the example, did you use the server-side events to set a certain property to false? thats really what im looking for.
              Scott Moniz - Computer Programmer/Analyst
              REA Inc.
              http://reainc.net
              (416)-533-3777
              [email protected]

              REA INC offers consulting services, programming services, systems design, database design, third party payment gateway integration (CHASE, PAYPAL, AUTHORIZE.NET) and developer support.
              If you need custom code, or 1-to-1 mentoring in any facet of your database/web application design,
              contact us to discuss options.

              Comment


                #8
                Re: Hide 'New Record' conditional Statement

                I basically just want to set a variable in the server side events that would disable the insert. For example, when you check the 'Allow Insert' flag you allow insert on the grid. When you uncheck, you disallow insert. I would like to set this at runtime based on my conditions.
                The whole, create your own hyperlink, write some javascript, do some lookups - its all hack-ish.
                Would be nice to go into server side events and OnGridExecute

                dim parent_item_status as C=lookupstatuscode()
                if parent_item_status=="COMPLETE" then
                e.tmpl.allow_insert=.f.
                end if

                Then the grid would render perfectly fine and all is done - how simple right?
                Unfortunately its hard to dig through docs and the xbasic.

                Anyways thanks for all your help, if any1 knows how to do this server side I would love to hear it
                Otherwise it looks like im just going to put code in the CanInsertRecord Event (but really the user shouldnt have to popup the detail view and enter a bunch of info just to see a 'Cannot add attachments to a item in CLOSED status).

                Thanks for all your input
                Scott Moniz - Computer Programmer/Analyst
                REA Inc.
                http://reainc.net
                (416)-533-3777
                [email protected]

                REA INC offers consulting services, programming services, systems design, database design, third party payment gateway integration (CHASE, PAYPAL, AUTHORIZE.NET) and developer support.
                If you need custom code, or 1-to-1 mentoring in any facet of your database/web application design,
                contact us to discuss options.

                Comment


                  #9
                  Re: Hide 'New Record' conditional Statement

                  Scott:
                  From what I understand
                  1) you have a parent grid - child grid settings where child grid is opened via LCS or row expander,
                  2) want to hide new record rows in child grid depending on a value in Parent record - for expl. hide new record rows in child if Color in parent is 'Red'.
                  If this is correct, post back, I might have a way out for you.

                  Comment


                    #10
                    Re: Hide 'New Record' conditional Statement

                    Originally posted by gaby_h View Post
                    Scott:
                    From what I understand
                    1) you have a parent grid - child grid settings where child grid is opened via LCS or row expander,
                    2) want to hide new record rows in child grid depending on a value in Parent record - for expl. hide new record rows in child if Color in parent is 'Red'.
                    If this is correct, post back, I might have a way out for you.
                    Almost correct. The child grid does not have new record rows. It has a detail view and I want to hide the New Record label.
                    I no longer need help with this item, I set the child grid to read only and wrote my own component to add entries to the child grid.
                    This component is opened with a button click of the parent.


                    Thanks Gaby (would be good if you responded anyhow, as i think this is a common occurence)
                    Scott Moniz - Computer Programmer/Analyst
                    REA Inc.
                    http://reainc.net
                    (416)-533-3777
                    [email protected]

                    REA INC offers consulting services, programming services, systems design, database design, third party payment gateway integration (CHASE, PAYPAL, AUTHORIZE.NET) and developer support.
                    If you need custom code, or 1-to-1 mentoring in any facet of your database/web application design,
                    contact us to discuss options.

                    Comment


                      #11
                      Re: Hide 'New Record' conditional Statement

                      To show/hide New Record hyperlink in child grid Toolbar that has a detail view (All work is done on client side and in the child grid) :.

                      - In DetView properties of child grid -> customization, replace the New Records label with <hide>
                      - Create your own 'new record' hyperlink button (using Action Buttons as explained in the jiffy help), place it on the toolbar of child grid
                      - In client side prop of the hyperlink button -> show/hide expression: lima()="yes" (js function)
                      - In Javascript Functions:
                      ~~~~~~
                      function lima()
                      {
                      var po={grid.Object}.getParentObject();
                      var roz = po.getValue('G','BILL_STATE',po._selectedRow);
                      if(roz=='MA') return ''; else if(roz !='MA') return 'yes'; ........or whatever other combination that works
                      }
                      ~~~~~~
                      The above Shows New Record hyperlink button only if Bill_State is 'MA' (invoices-Invdetails in AlphaSports) . Naturally need to get rid of NewRecord icon in DV TB

                      Hope that's what was needed.

                      Comment


                        #12
                        Re: Hide 'New Record' conditional Statement

                        Elegant... thanks Gaby.

                        Comment

                        Working...
                        X