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 11 of 11
  1. #1
    New to the CF scene
    Join Date
    May 2013
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Form/Grid Branching Method

    Hi All

    I am developing a web app that has a SQL backend. This app is intended for use by different departments in an insurance company. My navigation component needs to open different forms/grids depending on the nature of the claim, also different users require that customised forms/grids are made available for their specific purpose, or that one form/grid be linked to different data sources

    In the SQL database is a table containing a list of users and customised forms and data sources the need.

    I can create xBasic code to fetch the name of the form/grid or the data source and pass this value back to JavaScript. But I am stumped with how to code this in JavaScript (or is it not possible?)

    Does anybody have an example of the code or a pointer where I could look for an example?

    Best Regards
    Andrew

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,208
    Thanks
    75
    Thanked 4,343 Times in 4,309 Posts
    It's likely that this is better done by server side coding than in JavaScript.

    That is, you determine what form/grid to present and then, for example, transfer them to the right web page to display that particular form/grid.

    If you had a single web page with many forms/grids on in and then used JavaScript to only activate one of them, I think that would make your page way too big to manage well and be prone to coding errors.
    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.

  • #3
    New to the CF scene
    Join Date
    May 2013
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi Old Pedant. Thank You for your prompt reply.

    What I am considering is to have a page containing either the grid or form component placeholder and then change the actual form/grid component in that placeholder based on the value returned from SQL.

    Andrew

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,208
    Thanks
    75
    Thanked 4,343 Times in 4,309 Posts
    And "xBasic"??? Aside from the fact that the language is (a) ancient and (b) unsupported, how do you use SQL Server with it?

    Isn't a little past time to move to something more modern and supported?

    Given that you know xBasic, a likely choice might be to use ASP.NET and the VB.NET language.
    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.

  • #5
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,208
    Thanks
    75
    Thanked 4,343 Times in 4,309 Posts
    Quote Originally Posted by AndrewDB View Post
    Hi Old Pedant. Thank You for your prompt reply.

    What I am considering is to have a page containing either the grid or form component placeholder and then change the actual form/grid component in that placeholder based on the value returned from SQL.

    Andrew
    Okay, but that's still better done server side.

    I have no idea how you will get xBasic to act as a web server, but in conventional web languages, you can usually dynamically include content based on conditions in your program.

    But it's likely that a better approach would be to have a standard header and footer (and maybe side navigation) that is included on each page, where each page has a specific form/grid, and then transfer the user to the needed page based on your SQL query results.
    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.

  • #6
    New to the CF scene
    Join Date
    May 2013
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok, So I have just given my age away!! I am an old VB programmer that has spent the last 23 years on desktop apps. Working on web apps is a recent challenge to me.

    I am using Alpha5 (which works with JavaScript and xBasic ) to try and cope with this new learning curve.

  • #7
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,208
    Thanks
    75
    Thanked 4,343 Times in 4,309 Posts
    Having said all the above...

    You *can* do essentially the same thing in JavaScript.

    For example, you can use AJAX (look it up) to request a specific file (text or HTML or lots of other choices) from the server and then use JS DOM methods to plunk the physical (or logical !! if the file is, say, XML) contents on the page. And and and...

    Again, I don't know how you will use xBasic to serve up content to the web, but if you can make it do that, it could also work as the server side of your AJAX code.
    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.

  • #8
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,208
    Thanks
    75
    Thanked 4,343 Times in 4,309 Posts
    Quote Originally Posted by AndrewDB View Post
    I am using Alpha5 (which works with JavaScript and xBasic ) to try and cope with this new learning curve.
    Then you are probably best off following whatever Alpha5 recommends.

    (And I'll bet you aren't as old as I am. 69 in a couple of months. If I can still learn the new stuff, anybody can. And, yes, I grew up on BASIC, though admittedly mostly by writing BASIC interpreters for various computers.)
    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.

  • #9
    New to the CF scene
    Join Date
    May 2013
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for your advice.

    To continue with my original question: Once I have the value from the SQL table how would I code it in JavaScript to change the contents in the container on the page accordingly?

    As I understand it creating a separate page for each user will make the whole project far too big. Creating a component and then inserting it into the page would be better?

  • #10
    New to the CF scene
    Join Date
    May 2013
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm 69 the end of this month! The problem is that the folks at Alpha5 haven't responded to my question for a couple of days hence my search at an alternative forum.

  • #11
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,208
    Thanks
    75
    Thanked 4,343 Times in 4,309 Posts
    If this is for a personal site, one thing you probably could do without too much effort would be to learn ASP (not ASP.NET). ASP is considered obsolescent, but it's still built into every version of Windows except the Home Basic versions (that is, for example, it is in Windows7 Home Premium and above...but also in XP, Vista, etc.).

    ASP can be coded using VBScript. Not as rich a language as xBasic, but at least it would feel familiar to you.

    ASP is nowhere near as efficient (high performance) as ASP.NET or even PHP, but it's more than adequate for a site that gets no more than, say, one page hit every two seconds or so. (That's about 300,000 page hits per week, to put it in perspective.)

    It's just as convenient to write in as PHP, in the sense that you start with an HTML page and then just convert the dynamic parts of the page to VBScript.

    For example:
    Code:
    <html><body>
    Good morning, friend.
    </body></html>
    converts to
    Code:
    <html><body>
    <%
    If Hour(Now()) < 12 Then 
        Response.Write "Good morning, friend"
    Elseif Hour(Now()) < 17 Then
        Response.Write "Good afternoon, friend"
    Elseif Hour(Now()) < 21 Then
        Response.Write "Good evening, friend"
    Else
        Response.Write "Good night, friend"
    End If
    %>
    </body></html>
    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
    •