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 10 of 10
  1. #1
    New to the CF scene
    Join Date
    Jun 2009
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    increase size of alert

    for debugging, i create some alerts that can be sizeable. see attached for a sample of 1 that got truncated about 50% of total. is there someway to increase the size of the number of characters allowed in the alerts?
    bob
    Attached Thumbnails Attached Thumbnails increase size of alert-jscriptmsglimit.jpg  

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,082
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts
    There appears to be no limit to the number of charcaters in a normal Javascript alert. If you have created some kind of modal dialogue box, then you yourself have imposed the limit, possibly by limiting the size of the box.


    Quizmaster: What three-letter word means "at this moment"?
    Contestant: Then.

  • #3
    New to the CF scene
    Join Date
    Jun 2009
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i haven't created any modal dialog box
    i'm simply using alert(variable)
    the variable gets built by concatenating to it
    is there a default max character size to a variable?
    i've seen talk of 4096 but i'm not anywhere near that

  • #4
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,380
    Thanks
    11
    Thanked 592 Times in 572 Posts
    Quote Originally Posted by bbxrider View Post
    is there a default max character size to a variable?
    i've seen talk of 4096 but i'm not anywhere near that
    no limit, though a variable name is limited to 64kb in most implementations.
    i've loaded 50mb JSON files before, and it works, though it does take a little while.
    Last edited by rnd me; 07-26-2009 at 10:58 PM.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.6, IE11:9.1, IE9:3.1, IE10:3.0, FF:17.2, CH:46, SF:11.4, NON-MOUSE:38%

  • #5
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,082
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts
    Quote Originally Posted by bbxrider View Post
    i haven't created any modal dialog box
    i'm simply using alert(variable)
    the variable gets built by concatenating to itis there a default max character size to a variable?
    i've seen talk of 4096 but i'm not anywhere near that
    Check the concatenation syntax. (= instead of + ?)

  • #6
    New to the CF scene
    Join Date
    Jun 2009
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    this is the code--
    var msg1 = "";
    for ( var i =0; i < f.length; i++) {
    var e = f.elements[i];
    var opt = e.optional;
    msg1 += "for element " + i + " type= " + e.type + " name= " + e.name + " value= " + e.value + " optional= " + opt + " size= " + e.value.length + "\n";
    }
    alert(msg1);

    the form has 60 elements, see the attachment in original post, the message box cuts off at element 22, if i start the loop at 23, i get the next 22 elements

  • #7
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,082
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts
    What happens if you test with this:-

    alert (f.length);
    for ( var i =0; i < f.length; i++) {
    var e = f.elements[i];
    alert (e);
    //var opt = e.optional;
    //msg1 += "for element " + i + " type= " + e.type + " name= " + e.name + " value= " + e.value + " optional= " + opt + " size= " + e.value.length + "\n";
    }

  • #8
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,380
    Thanks
    11
    Thanked 592 Times in 572 Posts
    ok, i had an idea, (one of those things that only occur to you at 5am), and it seems to work pretty well.

    tested firefox3.5:
    Code:
    function promptLimited(str, lineLimit){
     lineLimit=lineLimit||20;
     var rows=str.split("\n");
     var pos=0;
     var bod=rows.slice(pos, pos+lineLimit);
     while(confirm(bod.join("\n")+"\n\n--- More? ---")){
        pos+=lineLimit;
       bod=rows.slice(pos, pos+lineLimit);
     }
    }
    
    //firebug test:
    promptLimited(document.body.innerHTML, 25); //25 line limit (defaults to 20 if not specified)

    feel free to jazz it up with line numbers or range indicators (viewing lines 20-40)...
    Last edited by rnd me; 07-27-2009 at 12:10 PM.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.6, IE11:9.1, IE9:3.1, IE10:3.0, FF:17.2, CH:46, SF:11.4, NON-MOUSE:38%

  • #9
    New to the CF scene
    Join Date
    Jun 2009
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks for thoughtful replies
    for the phillpm suggestion, alert(e), see attached, got that 60x

    for rnd_me, thanks for all that work, but i don't want to control how many items are displayed at once, i wanted to see them all, no matter how many, well within reason, like the 60 i have.

    but wait, i have to apologize, i should have checked first but its different with different browsers, so somehow its browser based?
    ie8=22ish
    ff=all
    chrome=23ish
    safari=41ish (safari on windows)

    so unless i find a 'production' need for the large display, i will just continue to debug in ff .
    Attached Thumbnails Attached Thumbnails increase size of alert-elements-no-concat.jpg  

  • #10
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,082
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts
    I think that the problem is not the size of the alert message, but the number of concatenations. IE has particular problems in this area, and gets slower and slower the longer your string is.

    Try something like:-

    var buffer = new Array();
    buffer.push ("More stuff");
    alert (buffer.join(""));


  •  

    Posting Permissions

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