Saturday, October 07, 2006

I wanted to allow a user to type in the address for their community and then instantly inform them whether the address they wanted was available.

In my controller:

def check_portal_url

In my view:

<%@comm = Portal.find_by_portal_url(@params[:search]) %>
<%if @comm%>
<%=@params[:search]%> is taken, please try a different address.
<%=@params[:search]%> is available.

and in my form

<%= observe_field(:portal_portal_url,
:frequency => 0.5,
:update => :observe_results,
:loading => "'spinner')",
:complete => "Element.hide('spinner')",
:url => { :controller=>'ajax',:action => 'check_portal_url' },
:with => "'search=' + escape(value)"
) %>

<div id="observe_results"></div>
In the above, the
                :with => "'search=' + escape(value)"

part is very important as without it, the value of the field will be very hard to access.


At 10:11 AM, Blogger sink sink socks said...

She caught his fat white hand, which was lying on the table, betweenher own and lifted it fett weib de to her lips.


Post a Comment

<< Home

eXTReMe Tracker