# Javascript disabled for link\_to\_remote

**URL:** <https://www.ruby-forum.com/t/javascript-disabled-for-link-to-remote/142959>\
**Category:** Rails\
**Created:** [July 13, 2008, 11:15pm UTC](https://www.ruby-forum.com/t/javascript-disabled-for-link-to-remote/142959 "2008-07-13T23:15:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jturney](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e99b99/32.png) [@jturney](https://www.ruby-forum.com/u/jturney)\
**Post date:** [July 13, 2008, 11:15pm UTC](https://www.ruby-forum.com/t/javascript-disabled-for-link-to-remote/142959/1 "2008-07-13T23:15:39Z")

</div>

Hi,

If a user doesn’t have javascript enabled, how would I know with the  
link\_to\_remote…

In my view, I have this:

\<%= link\_to\_remote( “Add user”,:url =\> { :action =\> :show\_add\_user } )  
%\>

And in my action, I have this:

def show\_add\_user  
if(reqest.xhr?)  
render :update do |rjs|  
rjs.replace\_html :add\_user\_form, :partial =\> ‘form’  
end  
else  
redirect\_to\_index(“Error”)  
end

But obviously this won’t work since the link\_to\_remote involves  
javascript already. What can I do?

Thanks

---

<div class="post-metadata">

**Author:** ![jturney](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e99b99/32.png) [@jturney](https://www.ruby-forum.com/u/jturney)\
**Post date:** [July 13, 2008, 11:44pm UTC](https://www.ruby-forum.com/t/javascript-disabled-for-link-to-remote/142959/2 "2008-07-13T23:44:32Z")

</div>

On Jul 13, 10:15 pm, Justin To [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> But obviously this won’t work since the link\_to\_remote involves  
> javascript already. What can I do?

Set the href on the link to what the user should see (instead of the  
default which is just ‘#’)

Fred

---

<div class="post-metadata">

**Author:** ![jturney](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e99b99/32.png) [@jturney](https://www.ruby-forum.com/u/jturney)\
**Post date:** [July 14, 2008, 11:27am UTC](https://www.ruby-forum.com/t/javascript-disabled-for-link-to-remote/142959/3 "2008-07-14T11:27:45Z")

</div>

On 14 Jul 2008, at 01:25, Justin To wrote:

> > Fred
> 
> Mmm… well how do I invoke an action with the link\_to\_remote when the  
> user has javascript disabled.
> 
> If I have an action called “add\_user”, would I still put this in the  
> href, and how?  
> You set the href attribute to the appropriate url (use url\_for)

Fred

---

<div class="post-metadata">

**Author:** ![jturney](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e99b99/32.png) [@jturney](https://www.ruby-forum.com/u/jturney)\
**Post date:** [July 14, 2008, 2:25am UTC](https://www.ruby-forum.com/t/javascript-disabled-for-link-to-remote/142959/4 "2008-07-14T02:25:34Z")

</div>

Frederick C. wrote:

> On Jul 13, 10:15ï¿½pm, Justin To [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> wrote:
> 
> > But obviously this won’t work since the link\_to\_remote involves  
> > javascript already. What can I do?
> 
> Set the href on the link to what the user should see (instead of the  
> default which is just ‘#’)
> 
> Fred

Mmm… well how do I invoke an action with the link\_to\_remote when the  
user has javascript disabled.

If I have an action called “add\_user”, would I still put this in the  
href, and how?

Thanks
