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

Freeform list showing HTML characters before populating

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

    Freeform list showing HTML characters before populating

    Hi. I hope someone will be able to help me with what should be a fairly simple problem. My very limited html and AA knowledge is not helping out.

    I use Ajax Callback xb function to retrieve data for the list.
    In a javascript function I populate the list's fields with those values, showing them in a freeform layout.
    The issue is, in those 1-2 seconds while the data is being retrieved, I can see only one row, empty but with the hardcoded character strings shown.
    After that, all of the needed rows display and all looks Ok.
    Is it possible to prevent the added html characters from showing up? I don't want to join them with the placeholders/variables beforehand.
    And I wouldn't want to show the list in another panel and use setting the panel active to buy me those 1-2 seconds.

    Example, from this excerpt of the freeform list layout, the words "Location:" and "|" will linger around before going away when the list is filled in.
    ----------
    <div class="{dialog.style}ListItemLabelMain">Location: {city1} | {country1}</div>
    ----------

    Now, I put the List in a Container and tried to hide the whole container with the list and the pre-display of those words.
    Didn't help and the ghostly first record showed up again, I guess because I didn't specify those actions to go single-threaded.
    This code in the onInitializeComplete of the component:
    ----------
    {dialog.object}.setControlDisplay('CONTAINER_1',false);
    {dialog.object}.runAction('ac_thegetxb');
    {dialog.object}.setControlDisplay('CONTAINER_1',true);
    // var lObj = {dialog.object}.getControl('listPlaces');
    //lObj.refresh();
    ----------

    Any ideas how can I get rid of the initial first record of the freeform list? Without adding javascript IFs, counting the records available at the time and hiding the hardcoded words.

    Thanks,
    Sime

    #2
    Re: Freeform list showing HTML characters before populating

    I'm not seeing this behaviour. What build of Alpha are you using? With your Freeform layout above, my List is empty until I send it data.

    Are you using the List method .populate() to populate your List with the returned XBasic data?
    What is in the Static Data property of the List Data Source?
    How much data are you sending to the List?

    Can you post a simple UX, Containing your List, and the Callback. Don't worry about your Callback code not being able to run... that's easily changed.

    Comment


      #3
      Re: Freeform list showing HTML characters before populating

      David, thank you for the reply! I'm sorry I forgot to put the build info:

      - Developer 12.4.2 build 3670

      - the query is quick, not a lot of data. In the xb function grabbing around 30 records out of 4000, I'd say.
      - not using .populate()
      - nothing in the Static Data - for the list's "Data source" I have this java function:

      function showData(){

      if({dialog.Object}.__datanazad==undefined){
      return '';
      }else{
      // show #ofrecs alert({dialog.Object}.__datanazad.length);
      var listData = [];
      for(i=0;i<{dialog.Object}.__datanazad.length;i++){

      // var todaydt = (new Date()).toISOString().split("T")[0]; //Ok, but it might be a day off, depending on the timezone

      var dateObj = new Date();
      var todaydt = dateObj.getFullYear() + "-" + String(dateObj.getMonth() + 1).padStart(2, "0") + "-" + String(dateObj.getDate()).padStart(2, "0");

      var listRow = {};
      listRow.job_filing_number = {dialog.Object}.__datanazad[i].job_filing_number;
      listRow.owner_name = {dialog.Object}.__datanazad[i].owner_name;

      listData.push(listRow);

      }
      return listData;
      }
      }


      -------------------------
      Apologies, this code is a mix up of two old ones - gotta geta good one as a sample.

      freeform html goes along these lines:


      <div style="display: table; width: 100%;">
      <div style="display: table-cell; vertical-align: middle;">

      {*if (expired_date < todaydt)}
      <div class="{dialog.style}ListItemLabelContext" style="float: right;color:white;background-color:red;">{expired_date}</div>
      {*else}
      <div class="{dialog.style}ListItemLabelContext" style="float: right;color:white;background-color:green;">{expired_date}</div>
      {*endif}

      <div class="{dialog.style}ListItemLabelMain">{job_filing_number} | {owner_name}</div>

      {*if (owner_business_name)}
      <div class="{dialog.style}ListItemLabelSub" style="color:#800080"><{owner_business_name}{<LogicalRowNumber>}></div>
      {*endif}

      </div>
      <div style="display: table-cell; width: 40px; text-align: right; vertical-align: middle;">
      <img src="{images.dialog.listNav}" />
      </div>
      </div>


      Thanks again!

      Comment


        #4
        Re: Freeform list showing HTML characters before populating

        The problem is that you're actually returning data for the List to work on... return '';

        It's empty... but it's data.

        Turn your if statement around...

        Code:
        	if({dialog.Object}.__datanazad != undefined){
        	
        		// put together your list data
        		return listData;
        	}
        If you don't have data... don't return anything at all.

        Comment


          #5
          Re: Freeform list showing HTML characters before populating

          I see what you mean - didn't think of the empty/blank data as different to null.

          Changed the code, per your recommendation, and I'm sure it's something minor but the list doesn't come up at all now.

          before:

          -----------------------
          if({dialog.Object}.__datanazad==undefined){
          return '';
          }else{
          -----------------------


          now:
          -----------------------
          if({dialog.Object}.__datanazad != undefined){
          -----------------------

          What did I do wrong?

          Comment


            #6
            Re: Freeform list showing HTML characters before populating

            You'd need to zip and post your UX.

            Comment


              #7
              Re: Freeform list showing HTML characters before populating

              I ran the code I posted and had no Javascript errors. I just ran it now and it's blowing up. Now the List doesn't like nothing being returned. Kinda makes sense, but no idea why it was working before.

              I think you may have to return JSON to the List... but one of the elements will be empty. Then wrap your Layout in an {*if} statement.

              Here is my showData function...

              Code:
              function showData(){
              
              	var listData;
              	
              	if({dialog.Object}.__datanazad != undefined){
              	
              		listData = {dialog.Object}.__datanazad;
              		// put together your list data
              	}else{
              	
              		listData = [
              			{"Firstname": ""} 
              		];	
              	}
              
              	return listData;
              
              }
              And here is my List FreeForm Layout...

              Code:
              {*if Firstname!=''}
              <div class="{dialog.style}ListItemLabelMain">Location: {City} | {State}</div>
              {*endif}
              If you don't have List data yet, then showData will return valid JSON... but with Firstname set to an empty string.

              The Layout {*if} statement tests Firstname... and if it's not empty the html is rendered.

              Using "Firstname" is just my example... and probably not a good idea for your List. Use an id field... or something you know will always have a value.

              You wouldn't have to jump through these hoops if the List property "Delay render til explicit refresh" was available... but it's removed because of the Data Source Type.
              You should ask Alpha to make it available for cases like this. It's odd because .refreshListData() works for this data source type... which is what you're using, I'm guessing, once you have data.

              You might be better off using the List .populate() method. Less mucking about. Either way you're feeding the List JSON... but with .populate() you have far more control.
              Last edited by Davidk; 08-11-2018, 03:07 AM.

              Comment


                #8
                Re: Freeform list showing HTML characters before populating

                Thanks David! It makes sense. I was looking for an equivalent of "Delay render til explicit refresh" as a silver bullet to take care of this minor issue. I understand the list.populate method will allow me use the Delay in the structure.
                Not a big problem since it shows only for a second being a short list but still a nuisance.

                And, why can't I do this simple work around that with this human-like sequence. To make it not asynchronous, execute in a sequence.

                {dialog.object}.setControlDisplay('CONTAINER_1',false); // hide the container where the empty list is, that shows the empty list with unwanted characters for a second
                {dialog.object}.runAction('ac_thegetxb'); // run the xb getting the data from the json, and after that run js function distributing the resulting data to the list
                {dialog.object}.setControlDisplay('CONTAINER_1',true); // show the container with now-populated list, skipping the 1 second of bare html words showing

                I won't get to the project over the weekend but after I'll try the minimum component to see if I'm making some mistake in this and post it. As you said, maybe Alpha needs to expand the Delay to this way of populating a list. And will rewrite with list.populate next.

                Thanks for your generous time and have a great weekend!

                Comment


                  #9
                  Re: Freeform list showing HTML characters before populating

                  Using the List .populate() method, you don't need any kind of delay. The List is built with Static Data. You provide only the Column Names in the Static Data property... e.g.

                  Code:
                  Firstname|Lastname|City|State
                  When the List is rendered, it's empty. Nothing from the FreeForm Layout is displayed... because the List has no data.

                  Return data from your callback, and use .populate() on your List. This is much easier that trying to get around timing... and showing/hiding.

                  The issue you're having with utilizing a Javascript Function for the List Data, but providing no Data, should probably be addressed in Alpha's logic. If there is no data, if data is empty, don't render.

                  Comment


                    #10
                    Re: Freeform list showing HTML characters before populating

                    Thanks David! Lesson learnt - I'll use mostly .populate() from now on, being instantaneous, so it doesn't render the empty records or the html skeletons they've mixed up with.

                    Comment


                      #11
                      Re: Freeform list showing HTML characters before populating

                      Both forms of providing List data are good. It just comes down to use case. Glad it worked out.

                      Comment


                        #12
                        Re: Freeform list showing HTML characters before populating

                        Couldn't do it without your help.
                        And I was hesitant to use {* for one non-existent record only, because I use a slow server. Although there're not many records to process and it's just a play project.

                        Comment

                        Working...
                        X