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

Variable In Html

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

    Variable In Html

    I am using HTML in a dialog message box for a desk top application and would like to insert a variable in the message body. I cannot seem to figure it out.

    Thanks!

    #2
    Re: Variable In Html

    Try something in this form:
    "blah, blah "+var->v_your variable+" some more blah."

    Raymond Lyons

    Comment


      #3
      Re: Variable In Html

      Nope. It displays the +var->x as text.

      Comment


        #4
        Re: Variable In Html

        First, I am no expert at this, so take what I say with a grain of salt.
        Second, I think even people with more expertise need more from you about the context and details of what you are trying to do, such as a sample database to work with.

        With that in mind, the following probably very crude code displays both field data and data contained in a variable when I stick it into an HTML memo field and/or when I send it as a message body in an email. Note the sent to "+var->v_email_to+".<br><br>" part, which is the variable and note that it is has quotation marks at each end (same goes for the fields B_F_Name, B_L_Name Ln_Off and Title).

        Code:
        email_ed.text= "<html><head> </head><body><div><P align=left\" class=style__1\"><p><FONT face=\"Tahoma\" style=\"font-size:10pt;color:#0000ff\"><br><br>The attached PDF file is for "+B_F_Name-" "+B_L_Name+" is being sent to "[COLOR=Red]+var->v_email_to+[/COLOR]".<br><br>"+Ln_off+"<br>"+title+"</p></div></body></body></html>"
        Maybe studying this a bit will help. If not, somebody else will have to help unless you upload a sample database with what you are trying to do.

        Raymond Lyons

        Comment


          #5
          Re: Variable In Html

          Originally posted by Alan Lee View Post
          Nope. It displays the +var->x as text.
          Yep.. it will display it as text.. that is until you evaluate it.
          Now you know what to do!

          Comment


            #6
            Re: Variable In Html

            Yup; evaluate_string() will do what you need.
            It is easier to get older than wiser

            Comment


              #7
              Re: Variable In Html

              Originally posted by mariusm View Post
              Yup; evaluate_string() will do what you need.
              Yes, but knowing the context, as I stated earlier, would help because some contexts, such as the two I mentioned [sticking my sample code into an HTML memo field and/or sending it as a message body in at least some A5 email functions] automatically handles the evaluation without using things like evaluate_string(). In this case, Alan stated "I am using HTML in a dialog message box." In that case, assuming the message box is somewhere where the variable and fields exist (e.g., on a form), the evaluation is automatic--at least it is in my testing.

              Raymond Lyons

              Comment


                #8
                Re: Variable In Html

                OP was there a solution? I'm running into the same issue on my project. I'd like to display "PO Number:" +PO_Number but i'm not having any luck coding the html using evaluate_string().

                Could someone post some sample html for reference?

                Here is what I have, PO_number is supposed to reference to my field:

                dialog.jpg

                <html>
                <head>
                <meta name="generator" content="Alpha Five HTML Editor">
                <title></title>
                <style>
                <!--
                p { margin-top: 0; margin-bottom: 0 }
                -->
                </style>
                </head>
                <body>
                <p>PO Number: +PO_number</p></body></html>

                Comment


                  #9
                  Re: Variable In Html

                  Any suggestions on how to display my PO_number field in html?

                  Comment


                    #10
                    Re: Variable In Html

                    Not clear on what you're doing. Xdialog? If so HTML text or HTML form? Or something else?
                    There can be only one.

                    Comment


                      #11
                      Re: Variable In Html

                      Try this.

                      Code:
                      dim global ht as C
                      dim po_number as C
                      po_number = "ABC123"
                      
                      ht = <<%strc%
                      <html>
                      <head>
                      <meta name="generator" content="Alpha Five HTML Editor">
                      <title></title>
                      <style>
                      <!--
                      p { margin-top: 0; margin-bottom: 0 }
                      -->
                      </style>
                      </head>
                      <body>
                      <p>PO Number: +PO_number</p></body></html>
                      %strc%
                      
                      ht = strtran(ht,"+PO_number",var->po_number)
                      
                      'Create an XDialog dialog box to prompt for parameters.
                      DIM tst as P
                      dim tst.object as p 
                      dim tst.class as c
                      tst.class = "dhtmledit.dhtmledit"
                      DIM SHARED varC_result as C
                      DIM tst_html as c 
                      tst_html = var->ht
                      'Force the background color of the html text to be Win3D so that it blends in with the Xdialog box.
                      dim win3dcolor as c 
                      win3dcolor = ui_color_format("win3d","#rhghbh")
                      
                      tst_html = a5_html_background(tst_html,win3dcolor)
                      ok_button_label = "&OK"
                      cancel_button_label = "&Cancel"
                      varC_result = ui_dlg_box("Alpha Five",<<%dlg%
                      {startup=init}
                      {region}
                      | {activex=40,5tst?.f.};
                      {endregion};
                      {line=1,0};
                      {region}
                      <*15=ok_button_label!OK> <15=cancel_button_label!CANCEL>
                      {endregion};
                      %dlg%,<<%code%
                      if a_dlg_button = "init" then 
                      	a_dlg_button = ""
                      	tst.object.browsemode = .t. 
                      	tst.object.appearance = 0
                      	tst.object.ScrollBars = .f.
                      	on error goto tst_error
                      	tst.object.documenthtml = tst_html
                      	on error goto 0
                      	tst.object.Refresh()
                      	a_dlg_button = ""
                      
                      end if
                      end 
                      
                      tst_error:
                      ui_msg_box("Error","Invalid URL or HTML content.",UI_STOP_SYMBOL)
                      end
                      %code%)
                      There can be only one.

                      Comment


                        #12
                        Re: Variable In Html

                        Stan, its a pop-up dialog box with html text. Is it possible to use a more simple code in the source window, what is necessary to edit in order to Show the PO number as a variable/field value?
                        dialog box.jpg

                        Comment


                          #13
                          Re: Variable In Html

                          You need to design the message box, capture the xbasic, then edit it.

                          Example:

                          Code:
                          [COLOR="#FF0000"]dim shared vpo_number as C
                          vpo_number = "ABC123"[/COLOR]
                          
                          'Displays a message box (style:'OK Button', image: 'No symbol', id: 'a').
                          DIM SHARED  a_result as N
                          DIM SHARED  a_OK_Button as L 
                          a_OK_Button = .F.
                          
                          title_var = ""
                          message_text_var = <<%text%
                          <html>
                          <head>
                          <meta name="generator" content="Alpha Five HTML Editor">
                          <title></title>
                          <style>
                          <!--
                          p { margin-top: 0; margin-bottom: 0 }
                          -->
                          </style>
                          </head>
                          <body>
                          <p>PO Number: +PO_number</p></body></html> 
                          %text%
                          
                          [COLOR="#FF0000"]message_text_var = strtran(message_text_var,"+PO_number",vpo_number)[/COLOR]
                          
                          a_result=ui_html_msg_box(title_var,message_text_var,UI_OK+ UI_FIRST_BUTTON_DEFAULT+ UI_NO_SYMBOL,2,1,.f.,.t.,"inches","inches","Win3D")
                          'Test to see which button on the message box was pressed....
                          SELECT
                          	CASE a_result = UI_OK_SELECTED
                          		a_OK_Button= .t.
                          END SELECT
                          The portions in red are what I added. In your case you wouldn't hard code the vpo_number in the code but would refer to the po_number available. If you are using this on a form where the po_number is an object on the form and the object name of the po_number field is po_number you could use

                          message_text_var = strtran(message_text_var,"+PO_number",po_number.value)
                          There can be only one.

                          Comment


                            #14
                            Re: Variable In Html

                            great, this makes sense. I was able to get it to work, but I wanted to change the size and alignment, when I did this the code stopped processing the strtran command. Here is what I have, the red is what was changed:

                            Code:
                            'Displays a message box (style:'OK Button', image: 'No symbol', id: 'a').
                            DIM SHARED  a_result as N
                            DIM SHARED  a_OK_Button as L 
                            a_OK_Button = .F.
                            
                            title_var = "PO Stamp"
                            message_text_var = <<%text%
                            <html>
                            <head>
                            <meta name="generator" content="Alpha Five HTML Editor">
                            <title></title>
                            <style>
                            <!--
                            p            { margin-top: 0; margin-bottom: 0 }
                            -->
                            </style>
                            </head>
                            <body>
                            [COLOR="#FF0000"]<p align=center>PO Number </p>
                            <p align=center><strong><font size=5>+PO_Number</font></strong></p></body></html>[/COLOR]
                            %text%
                            
                            message_text_var = strtran(message_text_var,"+PO_number",po_number.value)
                            
                            a_result=ui_html_msg_box(title_var,message_text_var,UI_OK+ UI_FIRST_BUTTON_DEFAULT+ UI_NO_SYMBOL,2,1,.f.,.t.,"inches","inches","Win3D")
                            'Test to see which button on the message box was pressed....
                            SELECT
                            	CASE a_result = UI_OK_SELECTED
                            		a_OK_Button= .t.
                            END SELECT

                            Comment


                              #15
                              Re: Variable In Html

                              Strtran() is case sensitive. You also changed +PO_number to +PO_Number.

                              Either change to stritran() or change the term to be replaced back to +PO_number.
                              There can be only one.

                              Comment

                              Working...
                              X