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 8 of 8
  1. #1
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Strange behaviour in window.prompt()

    Dear all

    I have been working with with window.promt() and i noticed a weird behaviour.

    In some cases (i do not known why) my prompt cannot get over a certain limit of characters. But in some other cases it can get as many characters as i want.

    Anyone know about this?

    Thanks
    Alex

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,079
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts
    Show us examples.

    There is a limit of 2048 characters but if you expect a response of that many characters a prompt box dialog is not the way to get the input data.

    It is your responsibility to die() if necessary….. - PHP Manual
    Last edited by Philip M; 12-06-2010 at 11:18 AM.

  • #3
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Tnx for the response.

    The strange thing is that i can enter only 90 characters.

    Any other idea for getting input data whould be great.

    Tnx

    Alex

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,079
    Thanks
    203
    Thanked 2,542 Times in 2,520 Posts
    Quote Originally Posted by Alex10 View Post
    The strange thing is that i can enter only 90 characters.
    Example? Which browser?
    For data input you should use a form with textboxes or textareas.

  • #5
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I use Titanium Developer framework to create an application.

    So i do not need to use any forms. It s just like procedural programming. The dialog box appears when the user wants to enter some value that will be used in further actions.

    I think Titanium is using Chrome as a browser engine but not so sure. Maybe this is a titanium's feature, although i couldnt find anything related to this in Titatium's forums.

    Thanks again.

  • #6
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Quote Originally Posted by Alex10 View Post
    I use Titanium Developer framework to create an application.
    It has no relevance which tool do you use. When you say something does not work, you must have tested in a browser, right? So:

    Show us the code and tell us in which browser does not work.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #7
    New to the CF scene
    Join Date
    Dec 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    function getURL(){
    var URL = window.prompt("Enter a web service's URL", "");
    openURL(URL);
    }

    This is the code. The prompt dialog box appears normally on the screen. But it can only accept 90 characters. So if a URL is less than that it cuts its suffix.

    The right answer for the browser that i used is Google Chrome. Because this is really a desktop application. I wrote javascript and i wrapped it with Titanium Developer Framework. Thus, i run it as an .exe file but behind that is actually Google Chrome.

    Tnx

  • #8
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    It works for me in Chrome 8/Win7 (and in all the browsers I have). Nor should be otherwise

    Code:
    <script type="text/javascript">
    function getURL(){
    var URL = window.prompt("Enter a web service's URL", "");
    location.href=URL;
    }
    And I have entered the string: "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678-91"
    It works without problem, as it should. I could have probably used up to 16000 characters, and safety up to 2000. But the maximum length of a valid URL is up to server, as well. I guess that your server is instructed to not accept more than 90 characters. By the way, how does that over 90 URL looks like?
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

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