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

Problem with dialog Aftervalidate Event syntax .

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

    Problem with dialog Aftervalidate Event syntax .

    Hello,

    I am trying to write the Xbasic code for a dialog AfterValid Event, that will send an html format e-mail to a recipient based on the variables collected.

    I used the help file and found an example in the message board. I thought I found the correct syntax!

    Any idea what am I doing wrong in writing the following code?

    Code:
    'DIM the dialog variables
    
    DIM var1 as c
    DIM var2 as c
    DIM var3 as c
    
    'Assign the variables their values
    var1 = CurrentForm.Controls.vLoc
    var2 = CurrentForm.Controls.vSup
    var3 = CurrentForm.Controls.vType
    
    'DIM the e-mail message
    
    DIM pm as P
    
    pm.from = "sender e-mail"
    pm.from_alias = "Alias"
    pm.to = "receiver e-mail"
    pm.subject = "subject"
    pm.html_message = <<%html%
    <html>
    <head> </head>
    <body>
    
    <table cellspacing="3" cellpadding="1" width="800" borderColor=black border=1>
    
    <tr><td width="90"><p>Location</p></td><td><%a5 ?var1 %></td></tr>
    <tr><td width="90"><p>Supplier</p></td><td><%a5 ?var2 %></td></tr>
    <tr><td width="90"><p>Type</p></td><td><%a5 ?var3 %></td></tr>
    </table>
    
    </body>
    </html>
    %html%
    
    email_send2(pm)
    The e-mail gets sent but in the e-mail body, a table shows the following output (not the dialog values):

    Location "\beginXbasicCodeBlock ?Loc \endXbasicCodeBlock"
    Supplier "\beginXbasicCodeBlock ?Sup \endXbasicCodeBlock
    Type "\beginXbasicCodeBlock ?Fut \endXbasicCodeBlock"


    Any guidance or help you may provide will be highly appreciated.

    Thank you.

    #2
    Re: Problem with dialog Aftervalidate Event syntax .

    Hi,
    See if this helps at all

    var1 = CurrentForm.Controls.vLoc.value
    var2 = CurrentForm.Controls.vSup.value
    var3 = CurrentForm.Controls.vType.value

    If that doesn't help, we'll try to determine where the error(s) is occuring

    Comment


      #3
      Re: Problem with dialog Aftervalidate Event syntax .

      Originally posted by ColinJD View Post
      Hi,
      See if this helps at all

      var1 = CurrentForm.Controls.vLoc.value
      var2 = CurrentForm.Controls.vSup.value
      var3 = CurrentForm.Controls.vType.value

      If that doesn't help, we'll try to determine where the error(s) is occuring
      Hello Colin,

      I have just tried adding ".value" as suggested but I am still getting the same output error.

      I really appreciate your help. Thank you.

      Regards.

      Comment


        #4
        Re: Problem with dialog Aftervalidate Event syntax .

        Hmmmm, interesting,
        ,
        You have XBASIC -> containing HTML -> Containing XBASIC all using block delimiters
        My guess is that it is confusing the assembler or processor in A5

        I'm just guessing at an idea here,

        pm.html_message = <<%HTML%
        <html>
        <head> </head>
        <body>

        <table cellspacing="3" cellpadding="1" width="800" borderColor=black border=1>
        <tr><td width="90"><p>Location</p></td><td>%html% +
        <%a5 ?var1 %> +
        <<%html% +
        </td></tr><tr><td width="90"><p>Supplier</p></td><td>%html% +
        <%a5 ?var2 %> +
        <<%html% </td></tr> <tr><td width="90"><p>Type</p></td><td>%html% +
        <%a5 ?var3 %> +
        <<%html% </td></tr>
        </table>
        </body>
        </html>
        %html%

        (Code above needs checking)

        Somehow you need to make it up of strings joined together

        I have an idea that before processing the code A5, parses it Working out what is A5 and what in HTML or a List etc which is why you are getting an error like \beginXbasicCodeBlock ?Loc \endXbasicCodeBlock"

        Comment


          #5
          Re: Problem with dialog Aftervalidate Event syntax .

          Originally posted by ColinJD View Post
          Hmmmm, interesting,
          ,
          You have XBASIC -> containing HTML -> Containing XBASIC all using block delimiters
          My guess is that it is confusing the assembler or processor in A5

          I'm just guessing at an idea here,

          pm.html_message = <<%HTML%
          <html>
          <head> </head>
          <body>

          <table cellspacing="3" cellpadding="1" width="800" borderColor=black border=1>
          <tr><td width="90"><p>Location</p></td><td>%html% +
          <%a5 ?var1 %> +
          <<%html% +
          </td></tr><tr><td width="90"><p>Supplier</p></td><td>%html% +
          <%a5 ?var2 %> +
          <<%html% </td></tr> <tr><td width="90"><p>Type</p></td><td>%html% +
          <%a5 ?var3 %> +
          <<%html% </td></tr>
          </table>
          </body>
          </html>
          %html%

          (Code above needs checking)

          Somehow you need to make it up of strings joined together

          I have an idea that before processing the code A5, parses it Working out what is A5 and what in HTML or a List etc which is why you are getting an error like \beginXbasicCodeBlock ?Loc \endXbasicCodeBlock"
          Thanks again for looking into this.

          I have tried the code above, without success. It is giving me an error at the first line:

          Code:
          [COLOR="Blue"]pm.html_message =  <<%HTML%[/COLOR]
          Thank you.

          Regards.

          Comment


            #6
            Re: Problem with dialog Aftervalidate Event syntax .

            Ok Just as a test, lets try a standard character string concat

            pm.html_message = "<html><head></head><body>"
            pm.html_message = pm.html_message + <%a5 ?var1 %>
            pm.html_message = pm.html_message + "<br>"
            pm.html_message = pm.html_message + <%a5 ?var1 %>
            pm.html_message = pm.html_message + "<br>"
            pm.html_message = pm.html_message + <%a5 ?var1 %>
            pm.html_message = pm.html_message + "</body>

            if this pumps out the right values, just add the HTML that you need to the string

            Comment


              #7
              Re: Problem with dialog Aftervalidate Event syntax .

              Originally posted by ColinJD View Post
              Ok Just as a test, lets try a standard character string concat

              pm.html_message = "<html><head></head><body>"
              pm.html_message = pm.html_message + <%a5 ?var1 %>
              pm.html_message = pm.html_message + "<br>"
              pm.html_message = pm.html_message + <%a5 ?var1 %>
              pm.html_message = pm.html_message + "<br>"
              pm.html_message = pm.html_message + <%a5 ?var1 %>
              pm.html_message = pm.html_message + "</body>

              if this pumps out the right values, just add the HTML that you need to the string
              Thanks Colin,

              I tried also this code and I got an error message. Please see attached screenshot.

              Regards.

              Comment


                #8
                Re: Problem with dialog Aftervalidate Event syntax .

                I didn't check your email_send syntax but to place a variable, remove the html and a5 brackets in your cell and use {var} as shown in red below.

                Code:
                'Assign the variables their values
                var1 = CurrentForm.Controls.vLoc
                var2 = CurrentForm.Controls.vSup
                var3 = CurrentForm.Controls.vType
                
                'DIM the e-mail message
                
                DIM pm as P
                
                pm.from = "sender e-mail"
                pm.from_alias = "Alias"
                pm.to = "receiver e-mail"
                pm.subject = "subject"
                pm.html_message = <<%html%
                <html>
                <head> </head>
                <body>
                
                <table cellspacing="3" cellpadding="1" width="800" borderColor=black border=1>
                
                <tr><td width="90"><p>Location</p></td><td>[COLOR="Red"]{var1}[/COLOR]</td></tr>
                <tr><td width="90"><p>Supplier</p></td><td>[COLOR="red"]{var2}[/COLOR]</td></tr>
                <tr><td width="90"><p>Type</p></td><td>[COLOR="red"]{var3}[/COLOR]</td></tr>
                </table>
                
                </body>
                </html>
                %html%
                
                email_send2(pm)

                Comment


                  #9
                  Re: Problem with dialog Aftervalidate Event syntax .

                  The html you are creating is just a string, so you can use string substitution.

                  Code:
                   
                  'DIM the e-mail message
                  
                  DIM pm as P
                  Dim vMsg as C
                  vMsg= <<%html%
                  <table cellspacing="3" cellpadding="1" width="800" borderColor=black border=1>
                  <tr><td width="90"><p>Location</p></td><td>var1</td></tr>
                  <tr><td width="90"><p>Supplier</p></td><td>var2</td></tr>
                  <tr><td width="90"><p>Type</p></td><td>var3</td></tr>
                  </table>
                  %html%
                  
                  'Assign the variables their values
                  vMsg=strtran(vMsg,"var1",CurrentForm.Controls.vLoc.value)
                  vMsg=strtran(vMsg,"var2",CurrentForm.Controls.vSup.value)
                  vMsg=strtran(vMsg,"var3",CurrentForm.Controls.vType.value)
                  
                  
                  pm.from = "sender e-mail"
                  pm.from_alias = "Alias"
                  pm.to = "receiver e-mail"
                  pm.subject = "subject"
                  pm.html_message=vMsg 
                  email_send2(pm)
                  Pat
                  Pat Bremkamp
                  MindKicks Consulting

                  Comment


                    #10
                    Re: Problem with dialog Aftervalidate Event syntax .

                    Originally posted by tdietrich View Post
                    I didn't check your email_send syntax but to place a variable, remove the html and a5 brackets in your cell and use {var} as shown in red below.

                    Code:
                    'Assign the variables their values
                    var1 = CurrentForm.Controls.vLoc
                    var2 = CurrentForm.Controls.vSup
                    var3 = CurrentForm.Controls.vType
                    
                    'DIM the e-mail message
                    
                    DIM pm as P
                    
                    pm.from = "sender e-mail"
                    pm.from_alias = "Alias"
                    pm.to = "receiver e-mail"
                    pm.subject = "subject"
                    pm.html_message = <<%html%
                    <html>
                    <head> </head>
                    <body>
                    
                    <table cellspacing="3" cellpadding="1" width="800" borderColor=black border=1>
                    
                    <tr><td width="90"><p>Location</p></td><td>[COLOR="Red"]{var1}[/COLOR]</td></tr>
                    <tr><td width="90"><p>Supplier</p></td><td>[COLOR="red"]{var2}[/COLOR]</td></tr>
                    <tr><td width="90"><p>Type</p></td><td>[COLOR="red"]{var3}[/COLOR]</td></tr>
                    </table>
                    
                    </body>
                    </html>
                    %html%
                    
                    email_send2(pm)
                    Thanks for your help Tom,

                    I did that but in the e-mail body html output, I got the variables between curly brackets {var}.

                    Location {var1}
                    Supplier {var2}
                    Type {var3}

                    I really appreciate your help.

                    Regards.

                    Comment


                      #11
                      Re: Problem with dialog Aftervalidate Event syntax .

                      Originally posted by Pat Bremkamp View Post
                      The html you are creating is just a string, so you can use string substitution.

                      Code:
                       
                      'DIM the e-mail message
                      
                      DIM pm as P
                      Dim vMsg as C
                      vMsg= <<%html%
                      <table cellspacing="3" cellpadding="1" width="800" borderColor=black border=1>
                      <tr><td width="90"><p>Location</p></td><td>var1</td></tr>
                      <tr><td width="90"><p>Supplier</p></td><td>var2</td></tr>
                      <tr><td width="90"><p>Type</p></td><td>var3</td></tr>
                      </table>
                      %html%
                      
                      'Assign the variables their values
                      vMsg=strtran(vMsg,"var1",CurrentForm.Controls.vLoc.value)
                      vMsg=strtran(vMsg,"var2",CurrentForm.Controls.vSup.value)
                      vMsg=strtran(vMsg,"var3",CurrentForm.Controls.vType.value)
                      
                      
                      pm.from = "sender e-mail"
                      pm.from_alias = "Alias"
                      pm.to = "receiver e-mail"
                      pm.subject = "subject"
                      pm.html_message=vMsg 
                      email_send2(pm)
                      Pat
                      Hello Pat,

                      Thanks for your help. Perfect!

                      Your solution worked like a charm! Thanks very much.

                      Regards.

                      Comment


                        #12
                        Re: Problem with dialog Aftervalidate Event syntax .

                        Try this code. You have to evaluate the string with the line pm.html_message = evaluate_string(pm.qq). I use email_smtp_open and code my smtp settings, so you might have to change that to whatever you use. I tried it earlier and it worked for me.

                        Code:
                        dim pm as P
                        dim ps as P
                        dim e_msg as C
                        
                        e_msg = <<%html%
                        <html>
                        <head> </head>
                        <body>
                        
                        <table cellspacing="3" cellpadding="1" width="800" borderColor=black border=1>
                        
                        <tr><td width="90"><p>Location</p></td><td>{var1}</td></tr>
                        <tr><td width="90"><p>Supplier</p></td><td>{var2}</td></tr>
                        <tr><td width="90"><p>Type</p></td><td>{var3}</td></tr>
                        </table>
                        
                        </body>
                        </html>
                        %html%
                        
                        
                        flag = email_smtp_open(ps, "smtp server name", 25, "useremail", "password")
                        if flag = .f. then
                        ?"error"
                        end
                        end if
                        pm.lrelated = .T.
                        pm._to = "recipient"
                        pm.from = "email address"
                        pm.from_alias = "alias"
                        pm.subject = "HTML Test"
                        pm.attachments = ""
                        pm.qq = e_msg
                        pm.html_message = evaluate_string(pm.qq)
                        email_result = email_smtp_send(pm, ps)
                        email_smtp_close(ps)

                        Comment


                          #13
                          Re: Problem with dialog Aftervalidate Event syntax .

                          Originally posted by tdietrich View Post
                          Try this code. You have to evaluate the string with the line pm.html_message = evaluate_string(pm.qq). I use email_smtp_open and code my smtp settings, so you might have to change that to whatever you use. I tried it earlier and it worked for me.

                          Code:
                          dim pm as P
                          dim ps as P
                          dim e_msg as C
                          
                          e_msg = <<%html%
                          <html>
                          <head> </head>
                          <body>
                          
                          <table cellspacing="3" cellpadding="1" width="800" borderColor=black border=1>
                          
                          <tr><td width="90"><p>Location</p></td><td>{var1}</td></tr>
                          <tr><td width="90"><p>Supplier</p></td><td>{var2}</td></tr>
                          <tr><td width="90"><p>Type</p></td><td>{var3}</td></tr>
                          </table>
                          
                          </body>
                          </html>
                          %html%
                          
                          
                          flag = email_smtp_open(ps, "smtp server name", 25, "useremail", "password")
                          if flag = .f. then
                          ?"error"
                          end
                          end if
                          pm.lrelated = .T.
                          pm._to = "recipient"
                          pm.from = "email address"
                          pm.from_alias = "alias"
                          pm.subject = "HTML Test"
                          pm.attachments = ""
                          pm.qq = e_msg
                          pm.html_message = evaluate_string(pm.qq)
                          email_result = email_smtp_send(pm, ps)
                          email_smtp_close(ps)

                          Thanks for your help again Tom,

                          I will try your solution when I get home this evening. Local time = utc +4.

                          Much appreciated.

                          Regards.

                          Comment

                          Working...
                          X