No such luck again. Here's the generated HTML:
<b>Status</b><br />
<select id="guarantee_status" name="guarantee[status]"><option
value="Due">Due</option>
<option value="Paid" selected="selected">In Progress</option></select>
</p>
<script type="text/javascript">
//<![CDATA[
new Form.Element.EventObserver('guarantee_status', function(element,
value) {new Ajax.Request('/licensors/change_status', {asynchronous:true,
evalScripts:true, parameters:'value=' + encodeURIComponent(value)})})
//]]>
</script>
<div id="balance_div" style="display:none">
<p>
<b>Remaining Balance</b><br />
<input id="guarantee_balance" name="guarantee[balance]" size="30"
type="text" value="2430.0000" />
</p>
</div>
<script type="text/javascript">
//<![CDATA[
olf = function() { $('guarantee_status').onchange() };
if (document.addEventListener)
window.addEventListener("load", olf, false);
else
window.attachEvent("onload", olf);
//]]>
</script>
Mark Reginald James wrote:
> Allen Walker wrote:
>> Doesn't work. I tried putting the javascript_tag right after the div and
>> outside the form itself. I understand the logic in the code but for some
>> reason the onchange event is not causing the "change_status" to get
>> fired. I even checked the development.log and change_status is not
>> getting called.
>
> OK, try this:
>
> <%= javascript_onload "$('guarantee_status').onchange()" %>
>
> using the following helper:
>
> def javascript_onload(js)
> javascript_tag <<-END
> olf = function() { #{js} };
> if (document.addEventListener)
> window.addEventListener("load", olf, false);
> else
> window.attachEvent("onload", olf);
> END
> end
>
> --
> Rails Wheels - Find Plugins, List & Sell Plugins -
> http://railswheels.com
--
Posted via http://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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---