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

How to make a field read only in a Dialog

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

    How to make a field read only in a Dialog

    In alpha five forms, fields can be set as read only, especially calculated fields, how do i do this in a Dialog Component?Thanks!

    #2
    Re: How to make a field read only in a Dialog

    Change the control type to Label.
    Regards
    Keith Hubert
    Alpha Guild Member
    London.
    KHDB Management Systems
    Skype = keith.hubert


    For your day-to-day Needs, you Need an Alpha Database!

    Comment


      #3
      Re: How to make a field read only in a Dialog

      Thank you Keith, that is what i tried before but the data on it could not be saved, i want the calculated fields not to be edited but the calculated value does not appear on the dbf table after clicking the submit button in the Dialog Component.

      Comment


        #4
        Re: How to make a field read only in a Dialog

        Your question should then have been "How do I save a calculated value from a Dialog Component into a dbf table"? A calculated value is already read only.

        Off the top of my head I dont know the correct answer, but I suspect you will need the e._set.field_name.value=calculated_field_value.
        Regards
        Keith Hubert
        Alpha Guild Member
        London.
        KHDB Management Systems
        Skype = keith.hubert


        For your day-to-day Needs, you Need an Alpha Database!

        Comment


          #5
          Re: How to make a field read only in a Dialog

          In a dialog component there is a read only expression available in the client side properties of the control settings, if you wish to make a control read only, set this expression to something that will always be true as in 1=1. This way the user can tab into the control but not alter its contents, if you wish to stop the user tabbing into the control put 2=1 in the enable expression box.

          Comment


            #6
            Re: How to make a field read only in a Dialog

            Originally posted by JetLi View Post
            In alpha five forms, fields can be set as read only, especially calculated fields, how do i do this in a Dialog Component?Thanks!
            1. Go to the Dialog Events section and select ClientSide
            2. Select the event "onInitializeComplete"
            3. Put this code in there and when the dialog opens up, the field will be readOnly

            $('{dialog.componentName}.V.R1.FIELDNAME').readOnly = true;

            Where FIELDNAME is the name of your field you want readOnly. Make sure your fields name is typed in all uppercase.
            Regards,
            Chet Sapino
            President,
            SAPINO Enterprises
            6451 Pheasant Rd
            East Syracuse, NY 13057

            Comment


              #7
              Re: How to make a field read only in a Dialog

              Thank you Lance, works fine, the problem now is that the field is dimmed, the user wants to see it clearly. What the user wants is to have the normal view which is not dimmed but the user must not be able to type on it, I tried 1=1 but the it can be still modified.

              Comment


                #8
                Re: How to make a field read only in a Dialog

                Originally posted by Chet Sapino View Post
                1. Go to the Dialog Events section and select ClientSide
                2. Select the event "onInitializeComplete"
                3. Put this code in there and when the dialog opens up, the field will be readOnly

                $('{dialog.componentName}.V.R1.FIELDNAME').readOnly = true;

                Where FIELDNAME is the name of your field you want readOnly. Make sure your fields name is typed in all uppercase.
                Chet, I tried your code but it is not working, I attached an image, pls view it and see what have i done for it not to work. Thanks!
                Attached Files

                Comment


                  #9
                  Re: How to make a field read only in a Dialog

                  You have the wrong code. It should be exactly this:

                  $('{dialog.componentName}.V.R1.GRANDTOTAL').readOnly = true;

                  Do not specify the name of the dialog component name. That's the problem.

                  I use this all the time and it does indeed work. As soon as the dialog is opened you will find the GRANDTOTAL control read only.

                  You can use this code with some modification (you have to determine the row number and create the string) in a repeating section too.
                  Regards,
                  Chet Sapino
                  President,
                  SAPINO Enterprises
                  6451 Pheasant Rd
                  East Syracuse, NY 13057

                  Comment


                    #10
                    Re: How to make a field read only in a Dialog

                    Chet, I don't know why it is not working for me,I copied your code and paste it in the OninitializeComplete event but I can still type and change the value in the grand total field.

                    Comment


                      #11
                      Re: How to make a field read only in a Dialog

                      This is some code I have in my dialog making several fields read only and setting other properties. There is a grand total field in my code called BALANCE.

                      This javascript stuff is all case sensitive. You can not say readonly, Readonly, or ReadOnly. It must be readOnly and there must be a semicolon at the end of each line.

                      The field names must be uppercase and exactly as defined in the component as the variable name up at the top under controls Field Properties.

                      {dialog.Object}.setFocus('OrderDate');
                      $('{dialog.componentName}.V.R1.TAXABLE').readOnly = true;
                      $('{dialog.componentName}.V.R1.SALESTAXRATE').readOnly = true;
                      $('{dialog.componentName}.V.R1.ORDERTERMS').readOnly = true;
                      $('{dialog.componentName}.V.R1.FPDSIC').readOnly = true;
                      $('{dialog.componentName}.V.R1.FPDAYS').readOnly = true;
                      $('{dialog.componentName}.V.R1.NETDAYS').readOnly = true;
                      $('{dialog.componentName}.V.R1.PRICELEVEL').readOnly = true;
                      $('{dialog.componentName}.V.R1.SUBTOTAL').readOnly = true;
                      $('{dialog.componentName}.V.R1.EXTAMOUNT').readOnly = true;
                      $('{dialog.componentName}.V.R1.SALESTAX').readOnly = true;
                      $('{dialog.componentName}.V.R1.ORDERTOTAL').readOnly = true;
                      $('{dialog.componentName}.V.R1.BALANCE').readOnly = true;
                      $('{dialog.componentName}.V.R1.TOTALPROFIT').readOnly = true;
                      $('{dialog.componentName}.V.R1.DISCAMOUNT').readOnly = true;
                      $('{dialog.componentName}.V.R1.COUNTY').readOnly = true;

                      $('{dialog.componentName}.V.R1.BUTTON_10008').disabled = true;
                      $('{dialog.componentName}.V.R1.BUTTON_10002').disabled = true;

                      These are textbox controls and some are calculated fields.

                      Try making another field in your dialog readOnly or creating a dummy dialog from one of the templates and try it. It has to work. You can click the mouse in a read only field but you can't change the contents. If the field is formatted using a client side format expression such as a dollar sign, you will lose the formatting momentarily and it will return as soon as you click out of the field. The field will look like a normal field in appearance and it will not be dimmed like an unenabled field.
                      Regards,
                      Chet Sapino
                      President,
                      SAPINO Enterprises
                      6451 Pheasant Rd
                      East Syracuse, NY 13057

                      Comment


                        #12
                        Re: How to make a field read only in a Dialog

                        Thank You Chet, I was trying in Working preview and it can be edited, after I tried calling it on the desktop with action script, you are right, it can't be edited. Maybe you know the things that are not applicable in working preview, it will help new developers to know the things like these, it has been 4 days till I got what I wanted on the user interface, not until you chimed in, I appreciate your great help chet

                        Edit:I think the Dialog Component that I am using is behaving badly, sometimes I don't know if I have done the wrong thing in Alpha Five,or I have done the right thing, even if i see actual examples of experts like you that are fully tested and have been working, when i try to do it in my own computer (copy paste so that it will work properly but....), the results are sometimes not producing the right thing, I'm a bit worried now, My comment above was made because suddenly i got it working on two controls,I made the post because prior to it, I can't make it readonly, Now, when I tried to do it on the third control and on the fourth control and so on, my goodness it is not working. Another thing Chet, Is the code that you used applicable in the repeating section of a Dialog Component?
                        Last edited by JetLi; 04-25-2012, 11:10 AM.

                        Comment


                          #13
                          Re: How to make a field read only in a Dialog

                          Keith maybe you still did not yet experience how to set the readonly of a calculated field on a dialog component. A calculated field in a Dialog component is not readonly by default, you must do what Chet suggested.

                          Comment


                            #14
                            Re: How to make a field read only in a Dialog

                            Chet, I found out that your code works in fields/controls don't work in a repeating section, I added a new control on the repeating section and added your code, it doesn't work, I move the new control outside the repeating section and it works, How do I make a field in a repeating section readonly? BTW, are your codes from an alpha documentation? or ALpha Wiki? I'm just wondering on some of the inconsistencies of the way codes are interpreted in alpha five, although not all to be fair but for this instance in a dialog component, why is the code working in some controls but not working inside of a frame or repeating section, please show me a link where I can read and apply the codes by myself. Thanks.

                            Comment


                              #15
                              Re: How to make a field read only in a Dialog

                              That code won't work in a repeating section because you have to know the row number which changes as you select it and then generate the correct code from a JavaScript on some other control which sets the readOnly attribute. Here is how to do it. This works very well.

                              Put this JavaScript in an onChange event on a control preceding the control you want to set as read only. When you tab off of it, it will set the control as readOnly. I use this on a lookup. After it does the lookup, it sets the control as read only. You can of course set as many controls as you want read only

                              var x = {dialog.Object}.getRepeatingSectionActiveRow('CONTAINER_1');
                              var fn = 'UM'; //'UM' is the field name in my repeating section I want readOnly
                              var y = fn + '_A5INSTANCE' + x;
                              var z ='{dialog.componentName}.V.R1.' + y;
                              alert(z); //check z to see what the generated string looks like. You can comment this out
                              $(z).readOnly = true;
                              Regards,
                              Chet Sapino
                              President,
                              SAPINO Enterprises
                              6451 Pheasant Rd
                              East Syracuse, NY 13057

                              Comment

                              Working...
                              X