RE: OnEnter issues
Actually, You are right, I am in a bad habit of intranet applications where the only browser to be used is IE. Under Mozilla products (Firefox etc..) you DO need to wrap the form tag for rendering. I am not sure if this is true with V2.0 of firefox but you did jog my memory on Netscape doing just that. Sorry to maybe have mislead anyone on that... Andrew Scott Senior Coldfusion Developer Aegeon Pty. Ltd. www.aegeon.com.au Phone:Â +613 Â 8676 4223 Mobile: 0404 998 273 -Original Message- From: Dinner [mailto:[EMAIL PROTECTED] Sent: Wednesday, 13 June 2007 9:58 AM To: CF-Talk Subject: Re: OnEnter issues On 6/12/07, Andrew Scott wrote: > > if it was me I would remove the form. > > Put the event onKeyUp="javascript:entermessage()" and then in the > entermessage check that the key up was indeed return (enter = 13). > > Then you remove the need for the unwanted form tags. I've got a habit, I think I picked it up from Netscape, of putting form fields in form tags, because IIRC, it wouldn't render the form field if it wasn't in one. Probably something long past being needed, but with the DOM being what it is, it's sometimes nice to have a wrapper for form type stuff. Also, if you do it right, you can have you your code gracefully degrade, when someone isn't using javascript. (probably not an issue in an app that relies on AJAX ;-}). I've got a 1 page example of some dojo JS that wraps a "normal" site in dojo-gooey-ness (Including forms and img/img areas!). I will share it for a million dollars in small unmarked bills. Or if asked. ~| ColdFusion 8 beta â Build next generation applications today. Free beta download on Labs http://www.adobe.com/cfusion/entitlement/index.cfm?e=labs_adobecf8_beta Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:280917 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: OnEnter issues
On 6/12/07, Andrew Scott wrote: > > if it was me I would remove the form. > > Put the event onKeyUp="javascript:entermessage()" and then in the > entermessage check that the key up was indeed return (enter = 13). > > Then you remove the need for the unwanted form tags. I've got a habit, I think I picked it up from Netscape, of putting form fields in form tags, because IIRC, it wouldn't render the form field if it wasn't in one. Probably something long past being needed, but with the DOM being what it is, it's sometimes nice to have a wrapper for form type stuff. Also, if you do it right, you can have you your code gracefully degrade, when someone isn't using javascript. (probably not an issue in an app that relies on AJAX ;-}). I've got a 1 page example of some dojo JS that wraps a "normal" site in dojo-gooey-ness (Including forms and img/img areas!). I will share it for a million dollars in small unmarked bills. Or if asked. ~| Create robust enterprise, web RIAs. Upgrade & integrate Adobe Coldfusion MX7 with Flex 2 http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:280896 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: OnEnter issues
if it was me I would remove the form. Put the event onKeyUp="javascript:entermessage()" and then in the entermessage check that the key up was indeed return (enter = 13). Then you remove the need for the unwanted form tags. On 6/12/07, Phillip M. Vector <[EMAIL PROTECTED]> wrote: > > That did it! THANK YOU! :) > > Dinner wrote: > > I don't know if there is an "onenter" input attribute... that might be a > > problem. > > > > In your case tho, I think you could just do this, and fake the enter > > key listener (since it's in a form, enter is bound by default to > submit). > > I think. > > > > > > > > Which I hope would fire every time enter is pressed, but don't know > > for sure. > > > > Otherwise you'd have to listen for a keypress, I guess, and see if > > the key pressed was the enter key. I've got some examples of that > > lying around if you need it. The interweb has 'em too. > > > > > > > > ~| ColdFusion 8 beta â Build next generation applications today. Free beta download on Labs http://www.adobe.com/cfusion/entitlement/index.cfm?e=labs_adobecf8_beta Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:280891 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: OnEnter issues
On 6/12/07, Phillip M. Vector wrote: > > That did it! THANK YOU! :) Woohoo! Sweet. You're welcome! JS is pretty fun once you start to get it. Very flexible... yeah. Have fun picking it up, it's more usefuller now than ever. Heh. Usefuller... ~| Create Web Applications With ColdFusion MX7 & Flex 2. Build powerful, scalable RIAs. Free Trial http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:280890 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: OnEnter issues
I'm not using any specific framework. My knowledge of AJAX is about *looks at watch* 2 days worth. :) It's for a personal website right now and I hope to get a book about it soon to get more advanced. Robertson-Ravo, Neil (RX) wrote: > I think a better practice would be to not use the enter button. What Ajax > framework if any are you using? Most should have a watcher / observer event > type system to monitor changes to a specific element. > > > > > > "This e-mail is from Reed Exhibitions (Gateway House, 28 The Quadrant, > Richmond, Surrey, TW9 1DN, United Kingdom), a division of Reed Business, > Registered in England, Number 678540. It contains information which is > confidential and may also be privileged. It is for the exclusive use of the > intended recipient(s). If you are not the intended recipient(s) please note > that any form of distribution, copying or use of this communication or the > information in it is strictly prohibited and may be unlawful. If you have > received this communication in error please return it to the sender or call > our switchboard on +44 (0) 20 89107910. The opinions expressed within this > communication are not necessarily those expressed by Reed Exhibitions." > Visit our website at http://www.reedexpo.com > > -Original Message- > From: Phillip M. Vector > To: CF-Talk > Sent: Tue Jun 12 00:18:05 2007 > Subject: OnEnter issues > > I have a form that I'm using with AJAX calls to the DB. > > I'd like to use Enter to call the AJAX function. However, the form is > trying to submit itself when I press enter. > > Is there a way of disableing enter from submitting a form on a page? Or > is there a workaround that someone can think of? I've tried redirecting > the form back to the form itself, but the problem becomes that I have a > onkeydown already defined and that seems to be taking presidence on the > calls. So it goes to the keydown and doesn't go to enter.. > > Any ideas? > > > > > Message: >onkeydown="showmessages()" size="40"> > > > > > > > > ~| Create Web Applications With ColdFusion MX7 & Flex 2. Build powerful, scalable RIAs. Free Trial http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:280756 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: OnEnter issues
That did it! THANK YOU! :) Dinner wrote: > I don't know if there is an "onenter" input attribute... that might be a > problem. > > In your case tho, I think you could just do this, and fake the enter > key listener (since it's in a form, enter is bound by default to submit). > I think. > > > > Which I hope would fire every time enter is pressed, but don't know > for sure. > > Otherwise you'd have to listen for a keypress, I guess, and see if > the key pressed was the enter key. I've got some examples of that > lying around if you need it. The interweb has 'em too. > > > ~| ColdFusion 8 beta â Build next generation applications today. Free beta download on Labs http://www.adobe.com/cfusion/entitlement/index.cfm?e=labs_adobecf8_beta Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:280755 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: OnEnter issues
AJax is javascript... So unless you want to submit the form, then no you do not need the form. Which is handy because then you do not need to override or cancel the onSubmit. On 6/12/07, Phillip M. Vector <[EMAIL PROTECTED]> wrote: > > Andrew Scott wrote: > > I am not sure what your question is asking. When you say enter Button, > are > > you referring to hitting the enter key? Because I do not see a button in > > your code? > > Yes. I mean the enter key. :) > > > On a side note, this is not an Ajax problem but what it appears to be if > I > > am guessing right is that the call to the server via > > > > var url="index.cfm?fuseaction=Chat.CheckMessages"; > > > > May be throwing an error at a guess. > > CheckMessages works perfectly. It's the other one that isn't > (EnterMessage). > > > Might I suggest getting firefox, downloading the plugin fireDebug and > > switching on HTTPRequests this will at least give you more information > on > > whether the call to the server is in fact throwing an error. Or you > could > > just look into the CF logs, but fireDebug is an easier and quicker way > of > > knowing. > > I have firebug installed before. The call isn't happening at all. I get > the "onkeydown" call, but not the "onenter" call. > > > Also by looking at your code, you have no submit button. Which means > that to > > wrap the in a form is not necessary either. Unless > you > > want to submit the entire form, but judging by your code this is not > what > > you are doing. So the form tags are not needed in this example. > > Oh? I thought you needed the form tag for ajax calls. Good to know. :) > > ~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJQ Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:280741 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: OnEnter issues
Actually you are right I missed that, the event is actually onKeyDown or onKeyUp I believe.. On 6/12/07, Dinner <[EMAIL PROTECTED]> wrote: > > I don't know if there is an "onenter" input attribute... that might be a > problem. > > In your case tho, I think you could just do this, and fake the enter > key listener (since it's in a form, enter is bound by default to submit). > I think. > > > > Which I hope would fire every time enter is pressed, but don't know > for sure. > > Otherwise you'd have to listen for a keypress, I guess, and see if > the key pressed was the enter key. I've got some examples of that > lying around if you need it. The interweb has 'em too. > > > ~| CF 8 â Scorpio beta now available, easily build great internet experiences â Try it now on Labs http://www.adobe.com/cfusion/entitlement/index.cfm?e=labs_adobecf8_beta Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:280740 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: OnEnter issues
I think a better practice would be to not use the enter button. What Ajax framework if any are you using? Most should have a watcher / observer event type system to monitor changes to a specific element. "This e-mail is from Reed Exhibitions (Gateway House, 28 The Quadrant, Richmond, Surrey, TW9 1DN, United Kingdom), a division of Reed Business, Registered in England, Number 678540. It contains information which is confidential and may also be privileged. It is for the exclusive use of the intended recipient(s). If you are not the intended recipient(s) please note that any form of distribution, copying or use of this communication or the information in it is strictly prohibited and may be unlawful. If you have received this communication in error please return it to the sender or call our switchboard on +44 (0) 20 89107910. The opinions expressed within this communication are not necessarily those expressed by Reed Exhibitions." Visit our website at http://www.reedexpo.com -Original Message- From: Phillip M. Vector To: CF-Talk Sent: Tue Jun 12 00:18:05 2007 Subject: OnEnter issues I have a form that I'm using with AJAX calls to the DB. I'd like to use Enter to call the AJAX function. However, the form is trying to submit itself when I press enter. Is there a way of disableing enter from submitting a form on a page? Or is there a workaround that someone can think of? I've tried redirecting the form back to the form itself, but the problem becomes that I have a onkeydown already defined and that seems to be taking presidence on the calls. So it goes to the keydown and doesn't go to enter.. Any ideas? Message: ~| ColdFusion MX7 by Adobe® Dyncamically transform webcontent into Adobe PDF with new ColdFusion MX7. Free Trial. http://www.adobe.com/products/coldfusion?sdid=RVJV Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:280738 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: OnEnter issues
I don't know if there is an "onenter" input attribute... that might be a problem. In your case tho, I think you could just do this, and fake the enter key listener (since it's in a form, enter is bound by default to submit). I think. Which I hope would fire every time enter is pressed, but don't know for sure. Otherwise you'd have to listen for a keypress, I guess, and see if the key pressed was the enter key. I've got some examples of that lying around if you need it. The interweb has 'em too. ~| Upgrade to Adobe ColdFusion MX7 The most significant release in over 10 years. Upgrade & see new features. http://www.adobe.com/products/coldfusion?sdid=RVJR Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:280735 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: OnEnter issues
Andrew Scott wrote: > I am not sure what your question is asking. When you say enter Button, are > you referring to hitting the enter key? Because I do not see a button in > your code? Yes. I mean the enter key. :) > On a side note, this is not an Ajax problem but what it appears to be if I > am guessing right is that the call to the server via > > var url="index.cfm?fuseaction=Chat.CheckMessages"; > > May be throwing an error at a guess. CheckMessages works perfectly. It's the other one that isn't (EnterMessage). > Might I suggest getting firefox, downloading the plugin fireDebug and > switching on HTTPRequests this will at least give you more information on > whether the call to the server is in fact throwing an error. Or you could > just look into the CF logs, but fireDebug is an easier and quicker way of > knowing. I have firebug installed before. The call isn't happening at all. I get the "onkeydown" call, but not the "onenter" call. > Also by looking at your code, you have no submit button. Which means that to > wrap the in a form is not necessary either. Unless you > want to submit the entire form, but judging by your code this is not what > you are doing. So the form tags are not needed in this example. Oh? I thought you needed the form tag for ajax calls. Good to know. :) ~| ColdFusion MX7 by Adobe® Dyncamically transform webcontent into Adobe PDF with new ColdFusion MX7. Free Trial. http://www.adobe.com/products/coldfusion?sdid=RVJV Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:280730 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: OnEnter issues
I am not sure what your question is asking. When you say enter Button, are you referring to hitting the enter key? Because I do not see a button in your code? On a side note, this is not an Ajax problem but what it appears to be if I am guessing right is that the call to the server via var url="index.cfm?fuseaction=Chat.CheckMessages"; May be throwing an error at a guess. Might I suggest getting firefox, downloading the plugin fireDebug and switching on HTTPRequests this will at least give you more information on whether the call to the server is in fact throwing an error. Or you could just look into the CF logs, but fireDebug is an easier and quicker way of knowing. Also by looking at your code, you have no submit button. Which means that to wrap the in a form is not necessary either. Unless you want to submit the entire form, but judging by your code this is not what you are doing. So the form tags are not needed in this example. Andrew Scott Senior Coldfusion Developer Aegeon Pty. Ltd. www.aegeon.com.au Phone: +613 8676 4223 Mobile: 0404 998 273 -Original Message- From: Phillip M. Vector [mailto:[EMAIL PROTECTED] Sent: Tuesday, 12 June 2007 11:30 AM To: CF-Talk Subject: Re: OnEnter issues Ok.. Last one today. I promise. :) This is just annoying as anything. Can someone please tell me why when I click the enter button, entermessage doesn't trigger? It just doesn't call it at all. Again, thanks for the help so far. Sorry to be such a neubie at AJAX. == var xmlHttp function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert("Your browser does not support AJAX!"); return false; } } } return xmlHttp; } function showmessages() { xmlHttp=GetXmlHttpObject() var url="index.cfm?fuseaction=Chat.CheckMessages"; url=url+"&room="+document.getElementById("Room").value; xmlHttp.onreadystatechange=stateChanged; xmlHttp.open("GET",url,true); xmlHttp.send(null); } function stateChanged() { if (xmlHttp.readyState==4) { document.getElementById("Messages").innerHTML=xmlHttp.responseText; } } function entermessage() { xmlHttp=GetXmlHttpObject() var url="index.cfm?fuseaction=Chat.EnterMessage"; url=url+"&room="+document.getElementById("Room").value; url=url+"&text="+document.getElementById("Message").value; xmlHttp.open("GET",url,true); xmlHttp.send(null); document.getElementById("Message").value=''; return false; } Message: ~| Create Web Applications With ColdFusion MX7 & Flex 2. Build powerful, scalable RIAs. Free Trial http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:280729 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: OnEnter issues
Ok.. Last one today. I promise. :) This is just annoying as anything. Can someone please tell me why when I click the enter button, entermessage doesn't trigger? It just doesn't call it at all. Again, thanks for the help so far. Sorry to be such a neubie at AJAX. == var xmlHttp function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert("Your browser does not support AJAX!"); return false; } } } return xmlHttp; } function showmessages() { xmlHttp=GetXmlHttpObject() var url="index.cfm?fuseaction=Chat.CheckMessages"; url=url+"&room="+document.getElementById("Room").value; xmlHttp.onreadystatechange=stateChanged; xmlHttp.open("GET",url,true); xmlHttp.send(null); } function stateChanged() { if (xmlHttp.readyState==4) { document.getElementById("Messages").innerHTML=xmlHttp.responseText; } } function entermessage() { xmlHttp=GetXmlHttpObject() var url="index.cfm?fuseaction=Chat.EnterMessage"; url=url+"&room="+document.getElementById("Room").value; url=url+"&text="+document.getElementById("Message").value; xmlHttp.open("GET",url,true); xmlHttp.send(null); document.getElementById("Message").value=''; return false; } Message: ~| Macromedia ColdFusion MX7 Upgrade to MX7 & experience time-saving features, more productivity. http://www.adobe.com/products/coldfusion?sdid=RVJW Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:280728 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: OnEnter issues
That did it. Thanks. :) I still got a problem with it, but at least this solves one of the problems. Thanks. :) Dinner wrote: > You'll probably have to "cancel" the original "enter" event. > > Or, you could fogogging-ogle it. =) > > Re, the foggogerler: > This can be achieved by submitting the form using the onClick event > handler instead of onSubmit event handler. It is necessary to return > false on event handler onSubmit to prevent submit on hitting ENTER > key. Sample code: > > > > I hope mike is making alot of money off his traffic... ;-) > > On 6/11/07, Phillip M. Vector wrote: >> I have a form that I'm using with AJAX calls to the DB. >> >> I'd like to use Enter to call the AJAX function. However, the form is >> trying to submit itself when I press enter. >> >> Is there a way of disableing enter from submitting a form on a page? Or >> is there a workaround that someone can think of? I've tried redirecting >> the form back to the form itself, but the problem becomes that I have a >> onkeydown already defined and that seems to be taking presidence on the >> calls. So it goes to the keydown and doesn't go to enter.. >> >> Any ideas? >> >> >> >> >> Message: >> > onkeydown="showmessages()" size="40"> >> >> >> >> > > ~| CF 8 â Scorpio beta now available, easily build great internet experiences â Try it now on Labs http://www.adobe.com/cfusion/entitlement/index.cfm?e=labs_adobecf8_beta Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:280727 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: OnEnter issues
You'll probably have to "cancel" the original "enter" event. Or, you could fogogging-ogle it. =) Re, the foggogerler: This can be achieved by submitting the form using the onClick event handler instead of onSubmit event handler. It is necessary to return false on event handler onSubmit to prevent submit on hitting ENTER key. Sample code: I hope mike is making alot of money off his traffic... ;-) On 6/11/07, Phillip M. Vector wrote: > I have a form that I'm using with AJAX calls to the DB. > > I'd like to use Enter to call the AJAX function. However, the form is > trying to submit itself when I press enter. > > Is there a way of disableing enter from submitting a form on a page? Or > is there a workaround that someone can think of? I've tried redirecting > the form back to the form itself, but the problem becomes that I have a > onkeydown already defined and that seems to be taking presidence on the > calls. So it goes to the keydown and doesn't go to enter.. > > Any ideas? > > > > > Message: > onkeydown="showmessages()" size="40"> > > > > ~| ColdFusion MX7 by Adobe® Dyncamically transform webcontent into Adobe PDF with new ColdFusion MX7. Free Trial. http://www.adobe.com/products/coldfusion?sdid=RVJV Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:280726 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4