PDA

View Full Version : Strange behaviour in window.prompt()



Alex10
12-06-2010, 10:52 AM
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

Philip M
12-06-2010, 11:15 AM
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

Alex10
12-06-2010, 11:21 AM
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

Philip M
12-06-2010, 11:32 AM
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.

Alex10
12-06-2010, 11:37 AM
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.

Kor
12-06-2010, 02:50 PM
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.

Alex10
12-06-2010, 03:25 PM
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

Kor
12-07-2010, 08:56 AM
It works for me in Chrome 8/Win7 (and in all the browsers I have). Nor should be otherwise



<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?