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

e.javascript being ignored??

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

    e.javascript being ignored??

    In my data bound UX (SQL backend) the below xbasic function is called via a button that first executes some JS and then goes on to this function. The function works as expected EXCEPT my e.javascript parts seems to be ignored. You can see i have a couple alerts setup but the never appear. I use e.javascript in my server-side xbasic functions and they work fine. But here in the 'xbasic functions' they are not. I don't get it...

    When a button is pressed this JS runs first...

    Code:
    var mrnum = prompt("Please enter a new MR number and press OK.", "");
    
    if (mrnum == null) {
        alert("You pressed cancel or didn't enter a MR number.");
    }    
    else if (mrnum != null){ 
        {dialog.Object}.setValue('JS_Variable',mrnum);
        {grid.Object}.ajaxCallback('G','{Grid.RowNumber}:all','Duplicate_Patient','','',{deviceOfflineFunction: function() {   }});
    } 
    else {
    }
    ...if the user entered data the JS above then calls upon my xbasic function...

    Code:
    function Duplicate_Patient as c (e as p)
    'Check to make sure MR num entered by user is unique
    'Duplicate patient data in SQL and add an entry into the PatientStatus table
    
    dim cn as sql::connection
    dim args as sql::arguments
    dim rs as sql::ResultSet
    dim result as l
    	
    args.set("arg1","Active")
    args.set("arg2",e._currentRowDataNew.ClientID)
    args.set("arg3",e._currentRowDataNew.FirstName)
    args.set("arg4",e._currentRowDataNew.Initial)
    args.set("arg5",e._currentRowDataNew.LastName)
    args.set("arg6",e._currentRowDataNew.Sex)
    args.set("arg7",e._currentRowDataNew.Date_of_birth)
    args.set("arg8",e._currentRowDataNew.SSN)
    args.set("arg9",e._currentRowDataNew.Race)
    args.set("arg10",e._currentRowDataNew.Religion)
    args.set("arg11",e._currentRowDataNew.Language)
    args.set("arg12",e._currentRowDataNew.Marital_status)
    args.set("arg13",e._currentRowDataNew.Ethnicity)
    args.set("arg14",e._currentRowDataNew.Phone)
    args.set("arg15",e._currentRowDataNew.Fax)
    args.set("arg16",e._currentRowDataNew.Cell)
    args.set("arg17",e._currentRowDataNew.OtherPhone)
    args.set("arg18",e._currentRowDataNew.Address)
    args.set("arg19",e._currentRowDataNew.GateCode)
    args.set("arg20",e._currentRowDataNew.Mileage)
    args.set("arg21",e._currentRowDataNew.City)
    args.set("arg22",e._currentRowDataNew.State)
    args.set("arg23",e._currentRowDataNew.Zip)
    args.set("arg24",e._currentRowDataNew.County)
    args.set("arg25",e._currentRowDataNew.Height)
    args.set("arg26",e._currentRowDataNew.JS_Variable)
    args.set("arg27",0)
    'args.set("arg28",val(e._currentRowDataNew.RC))
    'args.set("arg29",val(e._currentRowDataNew.CC))
    'args.set("arg30",val(e._currentRowDataNew.RSPT))
    'args.set("arg31",val(e._currentRowDataNew.GIP))
    
    result = cn.Open("::Name::sql")
                    if result
                                    sqlSelect = "SELECT ID FROM Patient WHERE MRNum = :arg26 AND clientid = :arg2"
                                    result = cn.Execute(sqlSelect,args)
                                    if result
                                                    rs = cn.ResultSet
                                                    result = rs.nextRow()
                                                    if result
                                                                    [COLOR="#FF0000"]e.javascript = "alert('The MR number you entered is already in use.');"[/COLOR]
                                                                    exit function
                                                                    end if
                                                    end if
                                    else
                                    e.javascript = "alert('Could not connect to database.');"
                                    exit function
                    end if
    
    
    cn.Execute("INSERT INTO Patient (Status, Clientid, Firstname, Initial, Lastname, Sex, DOB, SSN, Race, Religion, Language, MaritalStatus, Ethnicity, Phone, Fax, Cell, Otherphone, Address, Gatecode, Mileage, City, State, Zip, County, Height, MRNum, Record_delete) VALUES (:arg1, :arg2, :arg3, :arg4, :arg5, :arg6, :arg7, :arg8, :arg9, :arg10, :arg11, :arg12, :arg13, :arg14, :arg15, :arg16, :arg17, :arg18, :arg19, :arg20, :arg21, :arg22, :arg23, :arg24, :arg25, :arg26, :arg27)",args)
    
    cn.Execute("INSERT INTO PatientStatus (MRNum2, Status, Clientid2) VALUES (:arg26, :arg1, :arg2)",args)
    
    cn.close()
    
    [COLOR="#FF0000"]e.javascript = "alert('Patient record duplicated.');"[/COLOR]
    [COLOR="#FF0000"]e.javascript = "{dialog.object}.refreshListData('LIST1');"[/COLOR]
    
    end function
    The code in RED is what seems to be ignored .... am i doing something wrong??
    Mike Brown - Contact Me
    Programmatic Technologies, LLC
    Programmatic-Technologies.com
    Independent Developer & Consultant​​

    #2
    Re: e.javascript being ignored??

    I can place e.javascript = "alert('some text here');" in a server-side event and it works fine. If I place this same code inside a xbasic function (called via a button/ajax callback) it doesn't work ....

    There something wrong with this??

    Code:
    function test as c (e as p)
    
    e.javascript = "alert('some text here');"
    
    end function
    Mike Brown - Contact Me
    Programmatic Technologies, LLC
    Programmatic-Technologies.com
    Independent Developer & Consultant​​

    Comment


      #3
      Re: e.javascript being ignored??

      e.javascript = "alert('The MR number you entered is already in use.');"
      instead you should use
      Duplicate_patient = "alert('The MR number you entered is already in use.');"

      also

      Duplicate_Patient = "alert('Patient record duplicated.');"
      e.javascript = e.javascript + crlf() + "{dialog.object}.refreshListData('LIST1');"

      none of this is tested, but that is the way to do, I think.
      thanks for reading

      gandhi

      version 11 3381 - 4096
      mysql backend
      http://www.alphawebprogramming.blogspot.com
      [email protected]
      Skype:[email protected]
      1 914 924 5171

      Comment


        #4
        Re: e.javascript being ignored??

        YES! ....thank you.

        This worked: Duplicate_patient = "alert('The MR number you entered is already in use.');"

        I understand now what I did wrong.
        Mike Brown - Contact Me
        Programmatic Technologies, LLC
        Programmatic-Technologies.com
        Independent Developer & Consultant​​

        Comment


          #5
          Re: e.javascript being ignored??

          Originally posted by mikeallenbrown View Post
          In my data bound UX (SQL backend) the below xbasic function is called via a button that first executes some JS and then goes on to this function. The function works as expected EXCEPT my e.javascript parts seems to be ignored. You can see i have a couple alerts setup but the never appear. I use e.javascript in my server-side xbasic functions and they work fine. But here in the 'xbasic functions' they are not. I don't get it...

          When a button is pressed this JS runs first...

          Code:
          var mrnum = prompt("Please enter a new MR number and press OK.", "");
          
          if (mrnum == null) {
              alert("You pressed cancel or didn't enter a MR number.");
          }    
          else if (mrnum != null){ 
              {dialog.Object}.setValue('JS_Variable',mrnum);
              {grid.Object}.ajaxCallback('G','{Grid.RowNumber}:all','Duplicate_Patient','','',{deviceOfflineFunction: function() {   }});
          } 
          else {
          }
          ...if the user entered data the JS above then calls upon my xbasic function...

          Code:
          function Duplicate_Patient as c (e as p)
          'Check to make sure MR num entered by user is unique
          'Duplicate patient data in SQL and add an entry into the PatientStatus table
          
          dim cn as sql::connection
          dim args as sql::arguments
          dim rs as sql::ResultSet
          dim result as l
          	
          args.set("arg1","Active")
          args.set("arg2",e._currentRowDataNew.ClientID)
          args.set("arg3",e._currentRowDataNew.FirstName)
          args.set("arg4",e._currentRowDataNew.Initial)
          args.set("arg5",e._currentRowDataNew.LastName)
          args.set("arg6",e._currentRowDataNew.Sex)
          args.set("arg7",e._currentRowDataNew.Date_of_birth)
          args.set("arg8",e._currentRowDataNew.SSN)
          args.set("arg9",e._currentRowDataNew.Race)
          args.set("arg10",e._currentRowDataNew.Religion)
          args.set("arg11",e._currentRowDataNew.Language)
          args.set("arg12",e._currentRowDataNew.Marital_status)
          args.set("arg13",e._currentRowDataNew.Ethnicity)
          args.set("arg14",e._currentRowDataNew.Phone)
          args.set("arg15",e._currentRowDataNew.Fax)
          args.set("arg16",e._currentRowDataNew.Cell)
          args.set("arg17",e._currentRowDataNew.OtherPhone)
          args.set("arg18",e._currentRowDataNew.Address)
          args.set("arg19",e._currentRowDataNew.GateCode)
          args.set("arg20",e._currentRowDataNew.Mileage)
          args.set("arg21",e._currentRowDataNew.City)
          args.set("arg22",e._currentRowDataNew.State)
          args.set("arg23",e._currentRowDataNew.Zip)
          args.set("arg24",e._currentRowDataNew.County)
          args.set("arg25",e._currentRowDataNew.Height)
          args.set("arg26",e._currentRowDataNew.JS_Variable)
          args.set("arg27",0)
          'args.set("arg28",val(e._currentRowDataNew.RC))
          'args.set("arg29",val(e._currentRowDataNew.CC))
          'args.set("arg30",val(e._currentRowDataNew.RSPT))
          'args.set("arg31",val(e._currentRowDataNew.GIP))
          
          result = cn.Open("::Name::sql")
                          if result
                                          sqlSelect = "SELECT ID FROM Patient WHERE MRNum = :arg26 AND clientid = :arg2"
                                          result = cn.Execute(sqlSelect,args)
                                          if result
                                                          rs = cn.ResultSet
                                                          result = rs.nextRow()
                                                          if result
                                                                          [COLOR="#FF0000"]e.javascript = "alert('The MR number you entered is already in use.');"[/COLOR]
                                                                          exit function
                                                                          end if
                                                          end if
                                          else
                                          e.javascript = "alert('Could not connect to database.');"
                                          exit function
                          end if
          
          
          cn.Execute("INSERT INTO Patient (Status, Clientid, Firstname, Initial, Lastname, Sex, DOB, SSN, Race, Religion, Language, MaritalStatus, Ethnicity, Phone, Fax, Cell, Otherphone, Address, Gatecode, Mileage, City, State, Zip, County, Height, MRNum, Record_delete) VALUES (:arg1, :arg2, :arg3, :arg4, :arg5, :arg6, :arg7, :arg8, :arg9, :arg10, :arg11, :arg12, :arg13, :arg14, :arg15, :arg16, :arg17, :arg18, :arg19, :arg20, :arg21, :arg22, :arg23, :arg24, :arg25, :arg26, :arg27)",args)
          
          cn.Execute("INSERT INTO PatientStatus (MRNum2, Status, Clientid2) VALUES (:arg26, :arg1, :arg2)",args)
          
          cn.close()
          
          [COLOR="#FF0000"]e.javascript = "alert('Patient record duplicated.');"[/COLOR]
          [COLOR="#FF0000"]e.javascript = "{dialog.object}.refreshListData('LIST1');"[/COLOR]
          
          end function
          The code in RED is what seems to be ignored .... am i doing something wrong??
          I have some questions if you do not mind
          1> the connection is not closed after the duplicate entry is detected, do you think that is okay alpha will fix it or there will be any memory leaks?
          2> when the connection is attempted, when successful there are two possibilities (a) duplicate entry is prevented (b) could not connect to database., however if connection fails the cn.execute will need to run, is this intentional?
          Last edited by GGandhi; 08-22-2014, 05:59 PM.
          thanks for reading

          gandhi

          version 11 3381 - 4096
          mysql backend
          http://www.alphawebprogramming.blogspot.com
          [email protected]
          Skype:[email protected]
          1 914 924 5171

          Comment


            #6
            Re: e.javascript being ignored??

            Good point ....I've added a cn.close() after the duplicate message

            If the connection fails the function stops...there is an exit function underneath that.
            Mike Brown - Contact Me
            Programmatic Technologies, LLC
            Programmatic-Technologies.com
            Independent Developer & Consultant​​

            Comment


              #7
              Re: e.javascript being ignored??

              Code:
              if result
                                              sqlSelect = "SELECT ID FROM Patient WHERE MRNum = :arg26 AND clientid = :arg2"
                                              result = cn.Execute(sqlSelect,args)
                                              if result
                                                              rs = cn.ResultSet
                                                              result = rs.nextRow()
                                                              if result
                                                                              e.javascript = "alert('The MR number you entered is already in use.');"
                                                                              exit function
                                                                              end if
                                                              end if
                                              else
                                              e.javascript = "alert('Could not connect to database.');"
                                              exit function
                              end if
              this seems to be self contained, where does the cn object will come from if there is no duplicate entry?
              thanks for reading

              gandhi

              version 11 3381 - 4096
              mysql backend
              http://www.alphawebprogramming.blogspot.com
              [email protected]
              Skype:[email protected]
              1 914 924 5171

              Comment


                #8
                Re: e.javascript being ignored??

                That part of the code is something you helped me with a while back...here is the link to the post:

                http://msgboard.alphasoftware.com/al...uteError-event
                Mike Brown - Contact Me
                Programmatic Technologies, LLC
                Programmatic-Technologies.com
                Independent Developer & Consultant​​

                Comment


                  #9
                  Re: e.javascript being ignored??

                  ...I made a few changes as you can see.
                  Mike Brown - Contact Me
                  Programmatic Technologies, LLC
                  Programmatic-Technologies.com
                  Independent Developer & Consultant​​

                  Comment


                    #10
                    Re: e.javascript being ignored??

                    Code:
                    function Duplicate_Patient as c (e as p)
                    'Check to make sure MR num entered by user is unique
                    'Duplicate patient data in SQL and add an entry into the PatientStatus table
                    
                    dim cn as sql::connection
                    dim args as sql::arguments
                    dim rs as sql::ResultSet
                    dim result as l
                    	
                    args.set("arg1","Active")
                    args.set("arg2",e._currentRowDataNew.ClientID)
                    args.set("arg3",e._currentRowDataNew.FirstName)
                    args.set("arg4",e._currentRowDataNew.Initial)
                    args.set("arg5",e._currentRowDataNew.LastName)
                    args.set("arg6",e._currentRowDataNew.Sex)
                    args.set("arg7",e._currentRowDataNew.Date_of_birth)
                    args.set("arg8",e._currentRowDataNew.SSN)
                    args.set("arg9",e._currentRowDataNew.Race)
                    args.set("arg10",e._currentRowDataNew.Religion)
                    args.set("arg11",e._currentRowDataNew.Language)
                    args.set("arg12",e._currentRowDataNew.Marital_status)
                    args.set("arg13",e._currentRowDataNew.Ethnicity)
                    args.set("arg14",e._currentRowDataNew.Phone)
                    args.set("arg15",e._currentRowDataNew.Fax)
                    args.set("arg16",e._currentRowDataNew.Cell)
                    args.set("arg17",e._currentRowDataNew.OtherPhone)
                    args.set("arg18",e._currentRowDataNew.Address)
                    args.set("arg19",e._currentRowDataNew.GateCode)
                    args.set("arg20",e._currentRowDataNew.Mileage)
                    args.set("arg21",e._currentRowDataNew.City)
                    args.set("arg22",e._currentRowDataNew.State)
                    args.set("arg23",e._currentRowDataNew.Zip)
                    args.set("arg24",e._currentRowDataNew.County)
                    args.set("arg25",e._currentRowDataNew.Height)
                    args.set("arg26",e._currentRowDataNew.JS_Variable)
                    args.set("arg27",0)
                    'args.set("arg28",val(e._currentRowDataNew.RC))
                    'args.set("arg29",val(e._currentRowDataNew.CC))
                    'args.set("arg30",val(e._currentRowDataNew.RSPT))
                    'args.set("arg31",val(e._currentRowDataNew.GIP))
                    
                    result = cn.Open("::Name::sql")
                                    if result
                                                    sqlSelect = "SELECT ID FROM Patient WHERE MRNum = :arg26 AND clientid = :arg2"
                                                    result = cn.Execute(sqlSelect,args)
                                                    if result
                                                                    rs = cn.ResultSet
                                                                    result = rs.nextRow()
                                                                    if result
                                                                                    e.javascript = "alert('The MR number you entered is already in use.');"
                                                                                      [COLOR="#FF0000"]cn.close()[/COLOR]  
                                                                                       exit function
                    [COLOR="#FF0000"]                                                 else
                    dim sqlInsert as c
                    sqlInsert = <<%sql%
                    INSERT INTO Patient
                    (Status, Clientid, Firstname, Initial, Lastname, Sex, DOB, SSN, Race, Religion, Language, MaritalStatus, Ethnicity, Phone, Fax, Cell, Otherphone, Address, Gatecode, Mileage, City, State, Zip, County, Height, MRNum, Record_delete)
                     VALUES (:arg1, :arg2, :arg3, :arg4, :arg5, :arg6, :arg7, :arg8, :arg9, :arg10, :arg11, :arg12, :arg13, :arg14, :arg15, :arg16, :arg17, :arg18, :arg19, :arg20, :arg21, :arg22, :arg23, :arg24, :arg25, :arg26, :arg27)
                    %sql%
                    cn.execute(sqlInsert,args)
                    
                    cn.Execute("INSERT INTO PatientStatus (MRNum2, Status, Clientid2) VALUES (:arg26, :arg1, :arg2)",args)
                    
                    cn.close()[/COLOR]
                    e.javascript = "alert('Patient record duplicated.');"
                    e.javascript = "{dialog.object}.refreshListData('LIST1');"
                    
                    
                                                                     end if
                                                       end if
                                          [COLOR="#FF0000"]cn.close()[/COLOR]  
                                     else
                                                   [COLOR="#FF0000"] Duplicate_patient[/COLOR] = "alert('Could not connect to database.');"
                                                    
                                       end if
                    
                    
                    end function
                    this is the way I think, but put a debug on the top of your code and see if your function works well. then it is good.
                    Last edited by GGandhi; 08-22-2014, 06:42 PM.
                    thanks for reading

                    gandhi

                    version 11 3381 - 4096
                    mysql backend
                    http://www.alphawebprogramming.blogspot.com
                    [email protected]
                    Skype:[email protected]
                    1 914 924 5171

                    Comment


                      #11
                      Re: e.javascript being ignored??

                      I haven't done a debug but I have tested this on a live testing server. All works well. Thanks!
                      Mike Brown - Contact Me
                      Programmatic Technologies, LLC
                      Programmatic-Technologies.com
                      Independent Developer & Consultant​​

                      Comment


                        #12
                        Re: e.javascript being ignored??

                        ok good.
                        thanks for reading

                        gandhi

                        version 11 3381 - 4096
                        mysql backend
                        http://www.alphawebprogramming.blogspot.com
                        [email protected]
                        Skype:[email protected]
                        1 914 924 5171

                        Comment

                        Working...
                        X