Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Jul 2006
    Posts
    62
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Progressive enhance form with data feed ..??

    Hello:

    Hoping someone can help me with this. I have been asked to "progressively enhance" a form with a data feed, and I have to admit I do not understand what is needed to do this.

    It is suppose to display with or without JavaScript, so I assume I need JavaScript to make the data feed work ...

    page.html
    Code:
    ...
    <table>
      <tr>
        <td>Item 1</td>
        <td>Item 2</td>
        <td>Item 3</td>
      </tr>
    </table>
    ...
    
    <script src="datafeed.js" />
    Code:
    var feed = {
        "data":
        [
            {
                "Item 1":"Item 1 info",
                "Item 2":"Item 2 info",
                "Item 3":"Item 3 info"
            }
        ]
    }
    Anyone help me with this .. ??

    Thanks!

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,642
    Thanks
    6
    Thanked 1,005 Times in 978 Posts
    How about using the internet?

    Basically your form/data feed needs to work without JavaScript, and JS should be used to enhance the functionality in those devices that support it.

  • #3
    New Coder
    Join Date
    Jul 2006
    Posts
    62
    Thanks
    7
    Thanked 0 Times in 0 Posts
    I understand the concept.

    What I do not understand is how to populate the table with the data from the feed.

    I have never done this or heard of it, which is why I am asking for help on this forum.

    A code example of the technique would be great and very helpful.

    Thanks.

  • #4
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,642
    Thanks
    6
    Thanked 1,005 Times in 978 Posts
    You can’t do progressive enhancement with a form by just using JavaScript. Clearly, your data feed needs to be processed by a server-side script at first, so that when you submit the form, everything is processed and populated properly upon page (re)load. If that’s working you can use AJAX to send and retreive the data asynchronously (i. e. without reloading the whole page, just the bits of data that are actually changing).

    Your code example is a little vague in order to understand what you are trying to do.

  • #5
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,211
    Thanks
    75
    Thanked 4,343 Times in 4,309 Posts
    Quote Originally Posted by spacepoet View Post
    It is suppose to display with or without JavaScript, so I assume I need JavaScript to make the data feed work ...
    Not necessarily.

    There's no reason you couldn't process the data feed all in the server and use it to enhance the form *AS CREATED* by the server.

    It wouldn't "enhance" the form in real-time. It would only enhance it as the form is being created. But it *would* be enhanced.

    Heck, you could even use <iframe>s to hold data feed content and just use META-REFRESH to cause the <iframe>s to reload periodically, thus giving the same visual impression (perhaps) that JavaScript and AJAX could provide without the <iframe>s.

    And and and and...

    Your requirements are way way too vague for us to even guess what the real purpose/target it.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •