Well i’m thinking once again on Impromptu. My new thoughts are having multiple “states”. This would be completely optional and would not change the way you can use Impromptu in its simplest form. The idea behind States is after submitting the prompt, without closing it may morph into another “State” (different content and buttons ideally using pretty effects). That being said there are a few ways I could go about doing this. I could allow a string or a array/hash for my content argument:
//simple one state
$.prompt('hello world');
//complex multi state
$.prompt(['hello 1', 'hello 2', 'hello 3']);
While this seams nice we still may have different buttons for each state, and this isn’t very flexible as far as that goes. Another option may be to have another function to add extra states, sort of queuing up the prompts..
$.prompt('my state');
$.addPromptState('my state 2',options1);
$.addPromptState('my state 3',options2);
//or pass a hash to name our states
$.addPromptStates({
state1: {...},
state2: {...},
state3: {...}
});
So again I’m just throwing it out there to see if I get any bites. This isn’t set in stone but I think it could be a nice feature to ad some application like effects and feeling to Impromptu. Any one have any thoughts or suggestions?
Related posts:


26 Responses
Richard
12|Jul|2008 1I like your idea of states. I would fit well in a project that I’m doing where we have a text-to-speech engine and we could use the multi-states to display closed captioning or grab user input along the way.
We look forward to seeing your progress.
trent
12|Jul|2008 2Thanks for your interest. I hadn’t made much progress toward it since no one had responded or seemed interested. In the coming week I will try to begin development!
George
14|Jul|2008 3Great idea! But why not having a seperate callback option for the states? give it an option wich launches the callback for the states instead of the regular callback after clicking a button. the state-callback could react on any kind of selector inside the prompt and the attached function could change content and state…
offtopic: is there a way to use impromptu with the JS Packer? I get an error when using the plugin packed. :(
trent
14|Jul|2008 4So like an onStateChange callback that can be assigned to any element within the prompt? I’m not sure on the js packer issue, I will have a look at the code to see if I have left out any semicolons or anything that might screw it up. Thanks for the suggestions!
max
18|Jul|2008 5is possible to close the prompt using a callback?
trent
19|Jul|2008 6Hey Max, to remove the prompt there are a couple ways
var p = $.prompt(âhello worldâ);
//remove it quickly
p.remove();
//remove it prettily with hide
p.hide(âslowâ,function(){ $(this).remove(); });
or being its within a callback you will might need to do something like this:
jqib.remove();
Hope that helps!
Filipe
23|Jul|2008 7A nice thing would be a function to be executed as soon as the prompt is redered on the screen.
trent
23|Jul|2008 8Hey Filipe,
This feature is already available. It is the loaded function within the options.
bee
29|Jul|2008 9how to drag the box? i want to do it.
trent
31|Jul|2008 10Well since there are so many plugins available for drag and drop I might just do an example on how to use one of those plugins to do it. Seems like overkill to implement it when you may be including an dragdrop library already..
frank
08|Aug|2008 11This is great. Trying to use it as a login box. Have a couple of things I’m trying to figure out:
1) How do I post the data entered in the fields somewhere
2) How can I affect the original page the popup was called from (like refreshing the page, for example)
Thanks!
Nicola B.
18|Aug|2008 12Hi
I’m unable to contact you by mail. Please let me know how to do (you can see my mail)
Thanks
Nicola
Mike T
04|Sep|2008 13Hi,
Is there a way to popup the window once the page is loaded? Without clicking the button?
trent
04|Sep|2008 14There is no built in option for this but it is simple enough to do with jQuery.. To run any code at page load you write:
$(function(){
/* your code to run on page load.. */
$.prompt(‘hello world’);
});
this is jQuery’s short cut way of doing this and is really handy!
warpdesign
06|Oct|2008 15Nothing to do with that, but I’m looking for a way to make imprompty block the execution of JS, as is the original prompt() JS function…
trent
06|Oct|2008 16I don’t know if that is even possible without a prompt() or alert(). Everything runs off of callback functions, even if you use a timeout it would use callbacks as well..
mariecon de los reyes
07|Oct|2008 17hello there!
I’m using your jQuery Impromptu in my sites. I have a problem in IE7. There is an error – jqi.css is null or not an object. But in firefox no error exists. Can you help me with this one?
thanks in advance!
trent
08|Oct|2008 18Have you changed Impromptu to set any non ie css options?
Nikhil Kurup
19|Oct|2008 19I have found a small issue with the latest version of impromptu(1.5) when used in IE6 with other frameworks. At line nos 39 and 107, you have used the “$” shortcut. It has to be replaced with the longhand “jQuery” to ensure proper compatibility.
trent
20|Oct|2008 20Thanks for letting me know, that one slipped by me. I will try to release a fix tonight.
herr rilke
28|Oct|2008 21hello,
thanks for sharing this great plugin!
but i’m facing the same problem as mariecon de los reyes (no.17)
while FF3 and Chrome displaying everything as expected IE6 and IE 7 throw an error @ line 89:
jqi.css({ position: “absolute”, top: “100px”, left: “50%”, marginLeft: ((((jqi.css(“paddingLeft”).split(“px”)[0]*1) + jqi.width())/2)*-1) });
saying “jqi.css(…) is null or is not an object”.
then it shows the message-box at the bottom left corner of the page that is actually frozen.
and, trent, to answer the no. 18 question: it doesn’t make any difference if i’m using your css or mine :(
do you have an idea what’s going wrong?
i could send you access of my online application so far if that could help.
thank you!
trent
29|Oct|2008 22Is your code publicly available where I could take a look? If you prefer not to post the link on here the contact link at the top will send only me an email.
Mike C
24|Nov|2008 23Hey Trent, I gave Impromptu a spin today, great work! I started to head down the path of using it as a generic ajax small form control but I’ve run into a few issues and have come up with workarounds. One is the bubbling of key listeners. I tackled that in the loaded callback with a preventDefault. The other issue I encountered is dynamically resizing and recentering the form. I do not have a great solution yet. Again, in the Loaded function, I’m changing the width and then recentering. Ideally, I’d like to pass in an override width such as 500 and prompt auto handle it. Have you done anything like this?
Thanks,
Mike
trent
25|Nov|2008 24I haven’t tried dynamically resizing the prompt as that has never crossed my mind, but that would be pretty cool if it did that. Could you not just use the jQuery animate() function for this?
sachin
11|Dec|2008 25I am also getting the same problem as mariecon and herr rilke.
When i tried to figure out the problem, I came across ie6( which should be set to true when using IE6 or lower) variable in js source file, that gets set to true even though I am using IE7
trent
11|Dec|2008 26I think the issue with these was broken html. IE crashes with broken html where firefox recovers and sometimes figures out what you’re trying to do.
Leave a reply