Results 1 to 7 of 7

Thread: js problem with list list html

  1. #1
    Senior Member
    Join Date
    Feb 2012
    Location
    Germany, near Jena and Weimar
    Posts
    147

    js problem with list list html

    My js problem (see source text below):
    I call a xyz.rsp and want to get back a record (field "code") from table aufgmerk.
    All is ok, the HTML table opens, with onclick a js script is called,
    and alert in the script shows the right "code".

    Problem:
    I need the "code" to use in another table.
    How could I could get it out of the script, f.e. for use in xyz.rsp ?


    this is my xyz.rsp
    ------------------
    ...

    </head>
    <body>

    <%

    text raw
    <script type="text/javascript">
    function selectaufmerk(Code)
    {
    alert("Code="+Code);

    Lianja.hideDialogPanel();
    };
    </script>
    endtext

    save datasession

    use aufgmerk
    select aufgmerk

    list html off fields Code, BeschreibGer, BeschreibUSB onclick "Code","selectaufmerk('{}')"

    restore datasession

    %>

    </body>
    </html>

    Thanks in advance!
    Georg

  2. #2
    Lianja Team yvonne.milne's Avatar
    Join Date
    Feb 2012
    Location
    Berkshire, UK
    Posts
    1,404
    Hi Georg,

    In your JS function, use the Lianja.setDialogResult() method:

    Code:
    Lianja.setDialogResult(Code);
    then you can use the Lianja.getDialogResult() method to retrieve the value elsewhere in your App.

    Regards,

    Yvonne

  3. #3
    Senior Member
    Join Date
    Feb 2012
    Location
    Germany, near Jena and Weimar
    Posts
    147
    Thank you so much!
    Georg
    Last edited by gcjm; 2020-07-17 at 04:01.

  4. #4
    Senior Member
    Join Date
    Feb 2012
    Location
    Germany, near Jena and Weimar
    Posts
    147
    Here my (web) problem with set/getDialogResult().
    First the code and a description below.
    Pls see markers //// C //// A //// B ////
    Thanks Georg


    js function to get a "Code" from another table into the data source (memo field) of "aufmerk11"
    ---------------------------------------------------------------------------------------------------


    // Click on a button
    function personen2_personteil1_aufmerk_tabelle_click()
    {
    var cr = "\n";
    // the data source of "aufmerk11" is a memo field !
    var txt = Lianja.get("personen2.personteil1.aufmerk11").text ;

    // Show table to get a "Code"
    //// --- C --- ////
    //// in Web mode, the list html table appears but the program seems to run over showDialogPanel
    (it is not waiting for click on the table),
    so that getDialogResult() deliveres an "undefined" result
    Lianja.showDialogPanel("Meine Tabelle", "aufmerk_alle.rsp?searchvalue=BeschreibGer", -500);

    var code_ = Lianja.getDialogResult(); //// Tipp von Yvonne!

    // Lianja.showMessage("after showDialogPanel: code_= "+code_);

    if (empty(txt)) {txt = code_;} else {txt = txt + cr + code_;}
    Lianja.get("personen2.personteil1.aufmerk11").text = txt;

    // Lianja.showMessage("in js: txt = "+cr+txt);
    };

    The rsp file to get the "Code" by listhtml (more or less from Barry's examples)
    -------------------------------------------------------------------------------


    <%@ Language=VFP %>
    <html>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <head>

    <script type="text/javascript">
    if (typeof window.parent !== 'undefined' && typeof window.parent.Lianja !== 'undefined')
    {
    window.Lianja = window.parent.Lianja;
    };
    </script>

    <%
    if isServer()
    ? "Server"
    ? "<link type='text/css' href='../../library/jquery/css/smoothness/jquery-ui.css' rel='stylesheet' />"
    ? "<link rel='stylesheet' href='../../library/bootstrap/css/bootstrap.min.css' type='text/css'/>"
    ? '<script type="text/javascript" src="../../library/jquery/js/jquery.min.js"></script>'
    ? '<script type="text/javascript" src="../../library/jquery/js/jquery-ui.min.js"></script>'
    else
    ? "Not Server"
    ? "<link type='text/css' href='lib:/jquery/css/smoothness/jquery-ui.css' rel='stylesheet' />"
    ? "<link rel='stylesheet' href='lib:/bootstrap/css/bootstrap.min.css' type='text/css'/>"
    ? '<script type="text/javascript" src="lib:/jquery/js/jquery.min.js"></script>'
    ? '<script type="text/javascript" src="lib:/jquery/js/jquery-ui.min.js"></script>'
    endif

    %>

    //// (A) //// if the following script is positioned here (without text raw ... endtext), the list html table waits for a click on a line (that's what I need)
    </head>
    <body>

    <%

    //// (B) //// if the following script is positioned here, the list html table waits for a click on cancel or save
    text raw
    <script type="text/javascript">
    function selectaufmerk(Code)
    {
    // alert("Code="+Code);
    Lianja.setDialogResult(Code); //// Tipp von Yvonne!
    // Lianja.hideDialogPanel();
    };
    </script>
    endtext

    private m_search = getparameter("searchvalue","")

    // This is only needed when running in Desktop App View
    save datasession

    if !database() = "domodb_b"
    open database domodb_b
    endif

    do case
    case m_search = "BeschreibGer"
    use aufgmerk order TEXT_SEARCH
    case m_search = "Code"
    use aufgmerk order CODE_SEARCH
    endcase

    select aufgmerk
    list html off fields Code, BeschreibGer, BeschreibUSB onclick "Code","selectaufmerk('{}')"

    // This is only needed when running in Desktop App View
    restore datasession

    %>
    </body>
    </html>
    1) Pls see (A) and (B) positions of the "onclick" - script
    I don't know why there is a difference in fullfilling.

    2) In Desk mode it seems to run ok: The "Code" is inserted into "personen2.personteil1.aufmerk11".
    But if I click "Save Changes" the "Code" disappears again. (Because it is set programmatically and not manually?)

    3) This is my case I need!
    Pls see //// -- C --- //// above
    in Web mode, the list html table appears but the program seems to run over showDialogPanel (it is not waiting for click on the table),
    so that getDialogResult() deliveres an "undefined" result

  5. #5
    Lianja Team yvonne.milne's Avatar
    Join Date
    Feb 2012
    Location
    Berkshire, UK
    Posts
    1,404
    Hi Georg,

    The Lianja.showDialogPanel() is not modal, so command execution will continue without waiting for the dialog to be exited.

    What you can do is specify callback functions on the buttons of the Lianja.showDialogPanel(), e.g.

    Code:
    function personen2_personteil1_aufmerk_tabelle_click()
    {
    //...
    Lianja.showDialogPanel("Meine Tabelle", "aufmerk_alle.rsp?searchvalue=BeschreibGer", -500,"","",function() {handledialogpanel("done")},function() {handledialogpanel("cancel")} );
    //...
    };
    
    function handledialogpanel(button)
    {
    	var code = Lianja.getDialogResult();
    	// button is "done" or "cancel"
    	// code is the selected item
    	// handle the selected item as required
    };
    You will need to click to select an item then click on a button.

    Regards,

    Yvonne

  6. #6
    Senior Member
    Join Date
    Feb 2012
    Location
    Germany, near Jena and Weimar
    Posts
    147
    Sorry I don't understand your function handledialogpanel.

    How could I get "code" into the "function personen2_personteil1_aufmerk_tabelle_click()" to handle it?
    Maybe "code" should be global.
    But it doesn't work also not...

  7. #7
    Lianja Team yvonne.milne's Avatar
    Join Date
    Feb 2012
    Location
    Berkshire, UK
    Posts
    1,404
    Hi Georg,

    The handledialogpanel() function is the callback function for your Lianja.showDialogPanel() in personen2_personteil1_aufmerk_tabelle_click().

    Create it in your existing scripting library, give it a valid function name of your choice and put in it whatever you want to do with the selected 'code' that you previously had in personen2_personteil1_aufmerk_tabelle_click().

    Regards,

    Yvonne

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us