padenc2001-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Feb-11 02:31 UTC
Problem with updater and file fields
Im trying to use an updater on a form that has a file field however it appears that the updater isnt passing the information, heres a simplified version of the page: massmailer.php [code] <form name="newMessageForm" id="newMessageForm" action="/demos/ idan/index.php" method="post" onSubmit="return false;" enctype="multipart/form-data"> <table class="contentBox" cellpadding="1" cellspacing="1" style="width: 810px;"> <tr class="row1"> <td><b>Attachment:</b></td> <td><input name="attachment" type="file" id="attachment" size="80" class="button" /></td> </tr> </table> <input type="submit" class="formButton" value="Send the E- Mail!" /> </form> <script type="text/javascript"> var valid = new Validation(''newMessageForm'', {immediate : true, useTitles:true, onFormValidate : ValidateForm}); function ValidateForm() { switchToHTML(); new Ajax.Updater(''response'', ''ajax.php?action=massemail'', {asynchronous:true, parameters:Form.serialize(document.newMessageForm), evalScripts:true, onSuccess:function(){ clearForm(); }}); //switchToText(); return false; } function switchToHTML() { if (viewTextMode == 1) { formatText(''ViewSource'',''message''); } } function switchToText() { if (viewTextMode != 1) { formatText(''ViewText'',''message''); } } function clearForm() { document.newMessageForm.email_address.value = ''''; document.newMessageForm.subject.value = ''''; var doc document.getElementById(''wysiwygmessage'').contentWindow.document; // Write the textarea''s content into the iframe doc.open(); doc.write(''''); doc.close(); } </script> [/code] heres the ajax.php page code [code] //=============================================== // Mass Email //=============================================== elseif ($_GET[action] == "massemail") { echo $HTTP_POST_FILES[''attachment''][''name''] . "<br />" . $HTTP_POST_FILES[''attachment''][''tmp_name''] . "<br /><br />"; echo $FILES[''attachment''][''name''] . "<br />" . $FILES[''attachment''] [''tmp_name''] . "<br /><br />"; print_r($_FILES); print_r($_FILES[''attachment'']); } [/code] Any ideas whats going on? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I don''t see Validation class/function. Only ValidateForm()... --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
padenc2001-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Feb-11 14:41 UTC
Re: Problem with updater and file fields
sorry its part of an easy validation program, i know that part works, its one it makes the ajax updater request other variables from the full form make it through perfectly, its just the file field, im going to test real quick and see if its just not supported by scriptaculous On Feb 11, 6:16 am, Rauan Maemirov <rauan1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I don''t see Validation class/function. Only ValidateForm()...--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
you aren''t trying to upload a file are you? On Mon, Feb 11, 2008 at 9:41 AM, padenc2001-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <padenc2001-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > sorry its part of an easy validation program, i know that part works, > its one it makes the ajax updater request other variables from the > full form make it through perfectly, its just the file field, im going > to test real quick and see if its just not supported by scriptaculous > > On Feb 11, 6:16 am, Rauan Maemirov <rauan1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > I don''t see Validation class/function. Only ValidateForm()... > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Anyway U don''t use ValidateForm function where Ajax.Updater() called. On Feb 11, 8:41 pm, "padenc2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org" <padenc2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> sorry its part of an easy validation program, i know that part works, > its one it makes the ajax updater request other variables from the > full form make it through perfectly, its just the file field, im going > to test real quick and see if its just not supported by scriptaculous > > On Feb 11, 6:16 am, Rauan Maemirov <rauan1...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > I don''t see Validation class/function. Only ValidateForm()...--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---