You''re going to have problems - AJAX can''t typically access
file
fields (for
security reasons). Is there any reason that you can''t just add the
file fields
directly to the ticket? Maybe with some JS to show/hide them?
--Matt Jones
On Feb 20, 3:09 pm, Guillaume Loader <rails-mailing-l...@andreas-
s.net> wrote:> Hello everyone!
> Here is my problem. I have a form to create a ticket, and I want to
> upload a file in the same time.
> Basically, a user fill the form and then can attach a file while editing
> his ticket. But what I want to do here, is to send the file during the
> creation of the ticket.
>
> This is the form to create a ticket :
>
> <% form_for(@ticket) do |f| %>
>
> # My first field
> <%= f.label :subject, ''Subject: ''%>
> <%= f.text_field :subject, :size => 70 %>
>
> # Submit button
> <%= f.submit "Create" %>
> <% end %>
>
> And I want to add this form (see underneath) into the first form
> (mentioned above). But instead of sending POST data for this second
> form, I''d like to add this variables as hidden fields in the first
form.
>
> <% form_for(@ticket_attachment, :html => { :multipart => true })
do |f|
> %>
>
> <label>File: </label>
> <%= file_field(:ticket_attachment, :file) %>
>
> <%= hidden_field :ticket_attachment, :first_thing %>
> <%= hidden_field :ticket_attachment, :second_thing %>
>
> <%= f.submit "Upload" %>
>
> <% end %>
>
> Is that possible?! Maybe with ajax?
>
> Thank you!
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---