Saturday, January 21, 2012

.Net's AutoPostBack property in Rails 3

In this blog introduction, I mentioned that - “Ruby” is pretty and comfortable as my old Girlfriend! But in many cases I still miss my old friend “.Net”

AutoPostBack - this is where I miss my dude!

In ASP.Net we use this property to Get or Set a value indicating whether a postback to the server automatically occurs when the user changes the control selection.

We set this property to true if the server needs to capture the selection as soon as it is made. For example, other controls on the Web page can be automatically filled depending on the user's changes from a Control.

This property can be used to allow automatic population of other controls on the Web page based on a user's changes from a Control. And the value of this property is stored in view state.

AutoPostBack and Rails 3
Unfortunately, We don't have such property for controls in RoR!  But we've some alternative approachs
  1. Adding an OnChange() javascript function to Controls
  2. Using an Observe_field or Observe_form
But a bad news is, Observe_field or Observe_form is deprecated or moved from the latest stable version. The last existing version is v2.3.8

So, I've only option to use is OnChange() javascript function! or I can make use of my new girlfriend JQuery!

No comments:

Post a Comment