Displaying 20 results from an estimated 20000 matches similar to: "Javascript submit form & RJS"
2006 Jun 06
0
Get value from form using rjs, and problem with Safari
Hi,
I have got two forms, the first is a textarea plus a link that activates
some javascript to change the form, the second activates some javascript on
the onchange event which changes it into a textarea form.
This works in Firefox, but not in Safari.
Also, I need the value which is selected. I''ve found an example that gives
the parameter to the javascript, like this:
<input
2006 May 30
2
Wrong Content-type in RJS with Gettext
Hello,
I am developing an application using Rails and doing l10n with
ruby-gettext.
When I deploy the app on lighttpd, every rjs template is rendered with
Content-type: text/html; charset: UTF-8. I believe it comes from 85th
line of
rails.rb script in ruby-gettext lib. RJS templates are not executed in
this situation.
Hovewer, when I run the app with Webrick, rjs templates are rendered
with:
2006 Mar 14
2
rjs woes
i''ve just installed the RJS plugin per cody''s instructiuons and read through
tutorials. I''ve made the necessary changes to my existing code and
everything appears to be working, except that the returned javascript is not
being evaluated...
here''s my setup:
i have a checkbox with an onclick event pointing to a javascript function.
this javascript function does
2008 Jul 10
0
JavaScript Form Submit with form_remote_tag
I am trying to submit a form_remote_tag using javascript instead of a
regular form submit button. Here is my code:
<%=
form_remote_tag(
:url=> { :controller=>''store'', :action=>''add_to_cart_ajax'', :id =>
@product.id, :variation => @variations[i].id },
:html => {:name => ''add_product_form''},
:complete =>
2007 Apr 04
2
Simple RJS Calls Not Working
I have a simlple view:
<h2>Tags</h2>
<% unless @recipe.tags.empty? %>
<table>
<tbody id="tags">
<%= render :partial=>''tags/tag'', :collection=>@recipe.tags %>
</tbody>
</table>
<% end %>
<% form_remote_tag :url=>tags_path(@recipe) do%>
2006 Jun 16
2
RJS replaces JavaScript?
Hi All,
I am currently devleoping a Rails application and I need to do following as
part of client side operations,
1. HTML Form validations
2. AJAX
I am currently calling Javascript methods from views of my application; I
heard about RJS(Remote Javascripts) templates; are the replacing Javascript
altogether? can I use RJS for HTML Form validations and AJAX?
What I believe is that with RJS
2006 Apr 23
3
RJS not sent as text/javascript
I''ve made a couple of other posts about this and finally figured out what was
wrong. For some reason, the RJS response was not being sent with a content
type of "text/javascript" (which it should be, per the dox). The following
line in each controller method that renders RJS makes my app work:
@headers[''Content-Type''] = ''text/javascript''
2006 May 12
0
RJS questions
Hi!
1. Is it possible to execute rjs from onclick event?
2. Can i use rails code inside rjs? So i could easily add complicated
form elements like date_select etc?
3. If i have a form_remote_tag which calls action ''add_entry'', do i have
to somehow run render method to run rjs file or just create
add_entry.rjs file and it will be executed automatically?
4. Can i use rjs code
2008 Jul 22
5
RJS opener.reload()
Hello,
I have a problem with RJS.
I have a popup and by pressing a button within it I want to:
1. close this popup, which functions fine with onClick in the view and
2. reload the opener page of the popup after the called action in the
controller is done.
I tried:
render :update do |page|
page.opener.location.reload()
end
in the controller, but this didn''t work.
Can anyone
2006 Apr 06
4
Using RJS to call custom JavaScript class/method
The announcement for RoR 1.1 shows some nice examples of RJS calls. In
particular I am interested in this one:
# Call the custom JavaScript class/method AddressBook.cancel()
page.address_book.cancel
In trying to develop a "lightbox" style modal form, I have been
successful in saving the form data via AJAX but I can''t seem to close
the "lightbox". I am using the
2005 Dec 31
9
RJS Templates not conducting callbacks
I''ve run across a weird problem with RJS that I''m trying to figure out:
I have an application that was running 0.13.1 that I recently upgraded
to Rails 1.0. I wanted to use RJS templates, so I installed the plugin
and updated my prototype javascript file via ''rake update_prototype.''
I attempted to test the templates out via the following code, but the
AJAX
2006 Oct 10
7
Problems with RJS w/ Lighttpd & Ubuntu
I have my code working on my local machine no problem, but when I upload
to the server the RJS effects I have aren''t working. The server is
running Ubuntu Dapper w/ lighttpd while on my local machine I''m using
webrick.
For kicks I shut down lightty and booted my app on the server with
webrick and it works fine. So it''s definitely a lightty issue.
Anyone else seen
2009 Mar 07
0
RJS: pass javascript variables in ruby calls
Hey,
I have this link_to_function which takes an RJS block as follows:
page.insert_html :bottom, :documents,
:partial => "upload_fields",
:locals => { :doc => Document.new, :index => ''UNIQUE_ID'' }
It adds a partial to a div. I need index to be a unique id, but can''t
generate one.
I have an actual javascript function next_index() that will
2006 Sep 06
2
RJS Javascript oddity - trying to call Element.setStyle
Hi all,
I have a really simple web page. Right now, it''s just a button and a square
div. What I want to do is to change the background color of the div to red
when the button is clicked. My form code looks like this:
<%= form_remote_tag :url => {:action => ''color_show''} %>
color_show.rjs looks like this:
page <<
2005 Dec 15
2
Rails 1.0 & RJS Templates
Hello all,
I just successfully updated my dev env to Rails 1.0. I then wanted to
get .rjs templates working and followed Cody''s instructions at
http://www.codyfauser.com/articles/2005/12/02/rails-rjs-templates-plugin
. However, when I try to run ''rake test'' I get the following error:
(in
2009 Aug 07
2
calling a jQuery function from RJS/onclick
Hi,
I have the following jQuery function on the head of my page.
<script type="text/javascript">
jQuery.noConflict();
/* calling jNice on document ready */
jQuery(document).ready(function($)
{
$(''div.jNice'').jNice();
});
.....
</script>
On page load, this gets called correctly.
Now there''s a link on the page that lets me add more
2006 Jul 05
2
RJS - Getting and Setting Form Element Values Question
I''m still a beginner with RJS so forgive me if this is a simple one -
but certainly it doesn''t seem logical and googling has not led to .
Given a field with an id of ''posting_subject'' I can do the following in
my controller with RJS.
render :update do | page |
subject = ''this is really something
2006 Jul 08
1
Ajax, RJS, and Standard Form Errors
Hi all,
I''m trying to take the standard scaffold and add a bit for ajax to it. I
have a two column page with the list on the left and the right side is
reserved for the create/edit actions. On a successful save my rjs executes
and updates the list view on the left and returns the right side to a "home"
page. However, if one of the model validations fail I use rjs ro
2006 Mar 23
4
RJS and Form Validation (Best Practice)
Hello All !
I''ve been using RJS extensively, but haven''t done any form validation with
it until now.
Should I be manually passing the RJS template some models error messages
from the controller.... or
... should I be using error_messages_for in order to do the display ?
I''ve implemented the first approach, but it seems like quite a hack.
Any insight would be greatly
2007 Jul 06
0
Removing One Element From a Serialized Form
Hi all,
I''m trying to serialize a form with the exception of one specific
element.
Serializing the form in a hash (without pulling out specific elements)
works:
<li>
<%= link_to_remote ''(Save)'', {:url => post_path(@post), :with => "$
(''post_form'').serialize(true)" }, :method => :put %>
</li>
The generated code