Hi, I''m new to this, lerning every day. Here is my problem: my form: <div id="answer"></div> <form action="process.php" method="post" name="info" id="info" enctype="multipart/form-data" onSubmit="new Ajax.Updater(''answer'', ''processForm.php'', {parameters: Form.serialize(this), evalScripts:true, asynchronous:true}); return false;"> <p>Name: <input type="text" name="name" id="name" maxlength="10" value=""/> </p> <p> <input type="submit" name="submit" value="Send"> <p> </form> and here is my processForm.php <?php if (isset($_POST[''submit''])) { if (empty($_POST[''name''])) { echo "Enter your name"; } else { ?> <script> document.info.submit(); </script> <?php } } ?> I can not submit my form this way. Why not and how could I submit it? If instead of document.info.submit() I put alert(''Hello''); it alerts. Thanks in advance --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Aug 29, 7:17 pm, Mihail <drobti...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > > I''m new to this, lerning every day. Here is my problem: > > my form: > > <div id="answer"></div> > <form action="process.php" method="post" name="info" id="info" > enctype="multipart/form-data" onSubmit="new Ajax.Updater(''answer'', > ''processForm.php'', {parameters: Form.serialize(this), > evalScripts:true, asynchronous:true}); return false;"> > <p>Name: > <input type="text" name="name" id="name" maxlength="10" value=""/> > </p> > <p> > <input type="submit" name="submit" value="Send">A form control named "submit" masks the form''s submit method. There is rarely a need to name a submit button if it''s the only one in the form. [...]> <script> > document.info.submit();That will call the button named ''submit'', which doesn''t do anything useful. [...]> I can not submit my form this way. Why not and how could I submit it?Why? see above. How? Remove the name attribute, or change it to something other than submit (or reset or any other form method). -- Rob --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi from italy. Try this: <div id="answer"></div> <form action="process.php" method="post" name="info" id="info" enctype="multipart/form-data"> <p>Name: <input type="text" name="name" id="name" maxlength="10" value=""/></p> <p> <input type="button" name="go" value="Send" onclick="new Ajax.Updater(''answer'', ''processForm.php'', {parameters: Form.serialize($(''info'')), evalScripts:true, asynchronous:true}); return false;" /> </p> </form> processForm.php: <?php if (isset($_POST[''go''])) { if (empty($_POST[''name''])) { echo "Enter your name"; } else { ?> <script type="text/javascript"> document.info.submit(); </script> <?php } } ?> but I personally prefer to avoid these methods to submit forms ;) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> <div id="answer"></div> > <form action="process.php" method="post" name="info" id="info" > enctype="multipart/form-data" onSubmit="new Ajax.Updater(''answer'', > ''processForm.php'', {parameters: Form.serialize(this), > evalScripts:true, asynchronous:true}); return false;">Something that appears to have caused trouble for me is that when using onSubmit, the original <form info such as enctype seem lost. I switched from normal non-ajax form to ajax form with onsubmit, and it kills the ability of my form to successfully upload a file. I''m still hunting for ways to specify enctype within the Ajax.Updater call. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Sep 10, 2007, at 5:15 PM, jprather wrote:> I switched from normal non-ajax form to ajax form with onsubmit, > and it > kills the ability of my form to successfully upload a file. I''m still > hunting for ways to specify enctype within the Ajax.Updater call.... you can''t upload files with a pure Ajax solution. It''s a security restriction in Javascript. TAG --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---