On Nov 14, 2013, at 7:41 AM, RVic wrote:
> There has to be a better way to do this. What I am trying is not working, and seems convoluted. Essentially, a controller method is called, and exits by rendering a partial the purpose of which is to simply clear a textbox in the view. So I am calling the partial which established the textbox -- but it doesn't work (i.e. it doesn't clear the textbox). Does anyone know of a simpler way to do this that might work? Thanks, RVic, partial below:
I've read through this explanation and the code below twice, and I'm no closer to figuring out what you mean here. Can you give a slightly higher level explanation of what you're after here? I will be happy to help, but I don't understand what the trigger event needs to be to make the text field clear. You may be able to do all of this in JavaScript, or in a callback to another function (again, in JavaScript) that is doing the primary thing to make it necessary to clear this field.
So tell me a story like this:
When the foo picker is set to baz, clear the bar text field.
Something like that, except what you really want.
Walter
>
>
> <input id="channel_channelnote_note" name="channel[channelnote_note]" size="15" type="text" value="" onKeyUp="txtBox_onChange(this);" onClick="txtBox_onChange(this);"/>
>
> <div class="auto_complete" id="channel_channelnote_note_auto_complete"></div>
>
> <script type="text/javascript">
> //<![CDATA[
> var channel_channelnote_note_auto_completer = new Ajax.Autocompleter('channel_channelnote_note', 'channel_channelnote_note_auto_complete', '/channelnotes.js', {method:'get', paramName:'search'})
> //]]>
> </script>
>
> <%= observe_field 'channel_channelnote_note', :url => {:controller => :channels, :action => 'notesboxchange' }, :with => "'channelnotes=' + value" %>
> <script>
> var textbox = document.getElementByName('channel[channelnote_note]');
> textbox.value="";
> </script>
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to
rubyonra...@googlegroups.com.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/7a1776d7-75ff-4287-9214-ff3c1294f8da%40googlegroups.com.
> For more options, visit
https://groups.google.com/groups/opt_out.