Steve Finkelstein
2007-Jul-12 21:13 UTC
Simple form submission via prototype (newbie inquiry)
Hi all,
This is certainly an amateur inquiry and I appreciate your insight. I''m
currently looking to do some form submission which will then do
serverside database queries, etc. As of right now, I just want to get
the initial prototype library working. It looks like the following code
does not want to trigger ''forgot.php'' and return the echo
statement
which I''ve put in. Here''s a sample:
/* tooltip.php */
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8">
<script type="text/javascript"
src="../javascripts/prototype.js"></script>
</head>
<body>
<div id="updateDiv">
<form id="frmForgot">
<span style="font-size: 7pt;">Enter your username or email
address and
we will email you with further instructions.</span>
<input type="text" name="txtForgot"><br>
<input type="button" name="btnForgot"
value="Go" onClick="send();">
</form>
</div>
<script type="text/javascript">
function send() {
var params = Form.serialize($(''frmForgot''));
new Ajax.Updater(''updateDiv'',
''forgot.php'', {asynchronous:true,
parameters:params} );
}
</script>
</body>
</form>
</html>
/* forgot.php */
<?php
echo "Prototype rocks!";
?>
Thank you kindly for any insight.
- sf
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
Tom Gregory
2007-Jul-12 21:50 UTC
Re: Simple form submission via prototype (newbie inquiry)
Works just fine for me. I changed only the prototype path and the
target url ("forgot.php") to match my current setup.
Little nits:
1. asynchronous:true is a default behavior. Don''t need to specify it.
2. Don''t use a button.onclick observer in this case. Use a
form.onsubmit, and make the button type="submit".
3. Text at 7pt is horrendously small.
TAG
On Jul 12, 2007, at 3:13 PM, Steve Finkelstein wrote:
>
> Hi all,
>
> This is certainly an amateur inquiry and I appreciate your insight.
> I''m
> currently looking to do some form submission which will then do
> serverside database queries, etc. As of right now, I just want to get
> the initial prototype library working. It looks like the following
> code
> does not want to trigger ''forgot.php'' and return the echo
statement
> which I''ve put in. Here''s a sample:
>
> /* tooltip.php */
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
> "http://www.w3.org/TR/html4/strict.dtd">
> <html>
> <head>
> <meta http-equiv="Content-Type" content="text/html;
charset=utf-8">
> <script type="text/javascript"
src="../javascripts/prototype.js"></
> script>
> </head>
> <body>
> <div id="updateDiv">
> <form id="frmForgot">
> <span style="font-size: 7pt;">Enter your username or email
address and
> we will email you with further instructions.</span>
> <input type="text" name="txtForgot"><br>
> <input type="button" name="btnForgot"
value="Go" onClick="send();">
> </form>
> </div>
> <script type="text/javascript">
> function send() {
> var params = Form.serialize($(''frmForgot''));
> new Ajax.Updater(''updateDiv'',
''forgot.php'', {asynchronous:true,
> parameters:params} );
> }
> </script>
> </body>
> </form>
> </html>
>
> /* forgot.php */
>
> <?php
> echo "Prototype rocks!";
> ?>
>
> Thank you kindly for any insight.
>
> - sf
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
Steve Finkelstein
2007-Jul-13 02:29 UTC
Re: Simple form submission via prototype (newbie inquiry)
Thanks Tom. I just realized it works fine for me also when I access tooltip.php directly in the browser. However, I''m currently containing tooltip.php within a prototype window class (http://prototype-window.xilinus.com/) and something there is completely throwing it off. Nothing happens at all in FF. IE complains that it''s expecting an Object. I suppose I''ll search some more to see if there''s a conflict in libraries or something. - sf Tom Gregory wrote:> Works just fine for me. I changed only the prototype path and the > target url ("forgot.php") to match my current setup. > > Little nits: > 1. asynchronous:true is a default behavior. Don''t need to specify it. > 2. Don''t use a button.onclick observer in this case. Use a > form.onsubmit, and make the button type="submit". > 3. Text at 7pt is horrendously small. > > > TAG > > On Jul 12, 2007, at 3:13 PM, Steve Finkelstein wrote: > >> Hi all, >> >> This is certainly an amateur inquiry and I appreciate your insight. >> I''m >> currently looking to do some form submission which will then do >> serverside database queries, etc. As of right now, I just want to get >> the initial prototype library working. It looks like the following >> code >> does not want to trigger ''forgot.php'' and return the echo statement >> which I''ve put in. Here''s a sample: >> >> /* tooltip.php */ >> >> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" >> "http://www.w3.org/TR/html4/strict.dtd"> >> <html> >> <head> >> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> >> <script type="text/javascript" src="../javascripts/prototype.js"></ >> script> >> </head> >> <body> >> <div id="updateDiv"> >> <form id="frmForgot"> >> <span style="font-size: 7pt;">Enter your username or email address and >> we will email you with further instructions.</span> >> <input type="text" name="txtForgot"><br> >> <input type="button" name="btnForgot" value="Go" onClick="send();"> >> </form> >> </div> >> <script type="text/javascript"> >> function send() { >> var params = Form.serialize($(''frmForgot'')); >> new Ajax.Updater(''updateDiv'', ''forgot.php'', {asynchronous:true, >> parameters:params} ); >> } >> </script> >> </body> >> </form> >> </html> >> >> /* forgot.php */ >> >> <?php >> echo "Prototype rocks!"; >> ?> >> >> Thank you kindly for any insight. >> >> - sf >> > > > > > > !DSPAM:1020,4696a2aa277551735710337! >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---