Table of contents
- 1 Constructors
- 2 Methods
- 2.1 Service(IServiceProvider provider)
- 2.2 GetJavascriptFunctions() : String
- 2.3 GetBehaviourFunctions() : String
- 2.4 ReApply() : String
- 2.5 AddLoadEvent(String loadFunctionName) : String
- 2.6 StartBehaviourRegister() : String
- 2.7 Register(String selector, String eventName, String jsFunctionName) : String
- 2.8 EndBehaviourRegister() : String
- 2.9 GenerateJSProxy(String proxyName) : String
- 2.10 GenerateJSProxy(String proxyName, String controller) : String
- 2.11 GenerateJSProxy(String proxyName, String area, String controller) : String
- 2.12 LinkToFunction(String innerContent, String functionCodeOrName, IDictionary attributes) : String
- 2.13 LinkToFunction(String innerContent, String functionCodeOrName) : String
- 2.14 ButtonToFunction(String innerContent, String functionCodeOrName, IDictionary attributes) : String
- 2.15 ButtonToFunction(String innerContent, String functionCodeOrName) : String
- 2.16 ButtonToRemote(String innerContent, String url, IDictionary options) : String
- 2.17 ButtonToRemote(String innerContent, String url, IDictionary options, IDictionary htmloptions) : String
- 2.18 LinkToRemote(String innerContent, String url, IDictionary options) : String
- 2.19 LinkToRemote(String innerContent, String url, IDictionary options, IDictionary htmloptions) : String
- 2.20 BuildFormRemoteTag(String url, IDictionary options) : String
- 2.21 BuildFormRemoteTag(IDictionary options) : String
- 2.22 ObserveField(String fieldId, Int32 frequency, String url, String idOfElementToBeUpdated, String with) : String
- 2.23 ObserveField(String fieldId, Int32 frequency, String url, IDictionary options) : String
- 2.24 ObserveField(IDictionary options) : String
- 2.25 ObserveForm(String formId, Int32 frequency, String url, String idOfElementToBeUpdated, String with) : String
- 2.26 ObserveForm(String formId, IDictionary options) : String
- 2.27 ObserveForm(IDictionary options) : String
- 2.28 PeriodicallyCallRemote(IDictionary options) : String
- 2.29 PeriodicallyCallRemote(String url, IDictionary options) : String
- 2.30 InputTextWithAutoCompletion(IDictionary options, IDictionary tagAttributes) : String
- 2.31 InputTextWithAutoCompletion(String inputName, String url, IDictionary tagAttributes, IDictionary completionOptions) : String
- 2.32 AutoCompleteInputText(String elementId, String url, IDictionary options) : String
- 2.33 BuildRemoteFunction(String url, IDictionary options) : String
- 2.34 RemoteFunction(IDictionary options) : String
- 2.35 BuildAjaxOptions(IDictionary jsOptions, IDictionary options) : String
- 2.36 BuildCallbackFunction(CallbackEnum callback, String code, String name) : String
- 2.37 BuildObserver(String clazz, String name, IDictionary options) : String
- 2.38 GetOptions(String url, IDictionary options) : IDictionary
- 2.39 GetOptions(String url, String idOfElementToBeUpdated, String with, String loading, String loaded, String complete, String interactive) : IDictionary
AjaxHelper API Document
MonoRail Helper that delivers AJAX capabilities.
The following libraries are exposed:
Constructors
AjaxHelper()
Initializes a new instance of the Castle.MonoRail.Framework.Helpers.AjaxHelper class.
Methods
Service(IServiceProvider provider)
Invoked by the framework in order to give a chance to obtain other services
| Parameter | Description |
|---|---|
| provider | The service proviver |
GetJavascriptFunctions() : String
Renders a Javascript library inside a single script tag.
GetBehaviourFunctions() : String
Renders a script tag refering the Behaviour library code.
ReApply() : String
Renders a script block invoking Behaviour.apply()
AddLoadEvent(String loadFunctionName) : String
Renders a script block invoking Behaviour.addLoadEvent(loadFunctionName);
| Parameter | Description |
|---|---|
| loadFunctionName | The name of the js function to be invoked when the body is loaded |
StartBehaviourRegister() : String
Renders a script block starting the association of events to selector rules
Register(String selector, String eventName, String jsFunctionName) : String
Adds a entry to a registration array. Invoking it with #form, onsubmit and validate will produce '#form' : function(e){ e.onsubmit = validate; },
| Parameter | Description |
|---|---|
| selector | The css selector rule |
| eventName | The name of the event on the element |
| jsFunctionName | The function to be invoked in response to the event |
EndBehaviourRegister() : String
Renders the end of a script block that associated events to selector rules
GenerateJSProxy(String proxyName) : String
Generates an AJAX JavaScript proxy for the current controller.
| Parameter | Description |
|---|---|
| proxyName | Name of the javascript proxy object |
GenerateJSProxy(String proxyName, String controller) : String
Generates an AJAX JavaScript proxy for a given controller.
| Parameter | Description |
|---|---|
| proxyName | Name of the javascript proxy object |
| controller | Controller which will be target of the proxy |
GenerateJSProxy(String proxyName, String area, String controller) : String
Generates an AJAX JavaScript proxy for a given controller.
| Parameter | Description |
|---|---|
| proxyName | Name of the javascript proxy object |
| area | area which the controller belongs to |
| controller | Controller which will be target of the proxy |
LinkToFunction(String innerContent, String functionCodeOrName, IDictionary attributes) : String
Returns a link that will trigger a javascript function using the onclick handler and return false after the fact.
<a href="javascript:void(0);" onclick="functionCodeOrName; return false">innerContent</a>
| Parameter | Description |
|---|---|
| innerContent | Link content |
| functionCodeOrName | Function definition |
| attributes | Attributes to be applied to the html element |
LinkToFunction(String innerContent, String functionCodeOrName) : String
Returns a link that will trigger a javascript function using the onclick handler and return false after the fact.
| Parameter | Description |
|---|---|
| innerContent | Link content |
| functionCodeOrName | Function definition |
ButtonToFunction(String innerContent, String functionCodeOrName, IDictionary attributes) : String
Returns a button that will trigger a javascript function using the onclick handler and return false after the fact.
| Parameter | Description |
|---|---|
| innerContent | Button legend |
| functionCodeOrName | Function definition or name |
| attributes | Attributes to be applied to the input html element |
ButtonToFunction(String innerContent, String functionCodeOrName) : String
Returns a button that will trigger a javascript function using the onclick handler and return false after the fact.
| Parameter | Description |
|---|---|
| innerContent | Button legend |
| functionCodeOrName | Function definition or name |
ButtonToRemote(String innerContent, String url, IDictionary options) : String
Creates a button that if clicked will fire an Ajax invocation.
| Parameter | Description |
|---|---|
| innerContent | Button legend |
| url | The URL of the Ajax action |
| options | the options for the Ajax invocation |
ButtonToRemote(String innerContent, String url, IDictionary options, IDictionary htmloptions) : String
Creates a button that if clicked will fire an Ajax invocation.
| Parameter | Description |
|---|---|
| innerContent | Button legend |
| url | the target url |
| options | the options for the Ajax invocation |
| htmloptions | Attributes to be applied to the html element |
LinkToRemote(String innerContent, String url, IDictionary options) : String
Returns a link to a remote action defined by options["url"] that is called in the background using XMLHttpRequest. The result of that request can then be inserted into a DOM object whose id can be specified with options["update"]. Usually, the result would be a partial prepared by the controller
| Parameter | Description |
|---|---|
| innerContent | Link content |
| url | Target url |
| options | the options for the Ajax invocation |
LinkToRemote(String innerContent, String url, IDictionary options, IDictionary htmloptions) : String
Returns a link to a remote action defined by options["url"] that is called in the background using XMLHttpRequest. The result of that request can then be inserted into a DOM object whose id can be specified with options["update"]. Usually, the result would be a partial prepared by the controller
| Parameter | Description |
|---|---|
| innerContent | Link content |
| url | Target url |
| options | the options for the Ajax invocation |
| htmloptions | Attributes to be applied to the html element |
BuildFormRemoteTag(String url, IDictionary options) : String
Returns a form tag that will submit using XMLHttpRequest in the background instead of the regular reloading POST arrangement. Even though it is using Javascript to serialize the form elements, the form submission will work just like a regular submission as viewed by the receiving side (all elements available).
| Parameter | Description |
|---|---|
| url | Target url |
| options | the options for the Ajax invocation |
BuildFormRemoteTag(IDictionary options) : String
Returns a form tag that will submit using XMLHttpRequest in the background instead of the regular reloading POST arrangement. Even though it is using Javascript to serialize the form elements, the form submission will work just like a regular submission as viewed by the receiving side (all elements available).
| Parameter | Description |
|---|---|
| options | the options for the Ajax invocation |
ObserveField(String fieldId, Int32 frequency, String url, String idOfElementToBeUpdated, String with) : String
Observes the field with the DOM ID specified by fieldId and makes an Ajax when its contents have changed.
| Parameter | Description |
|---|---|
| fieldId | Form field to be observed |
| frequency | The frequency (in seconds) at which changes to this field will be detected. (required) |
| url | url for the action to call when the field has changed (required) |
| idOfElementToBeUpdated | Specifies the DOM ID of the element whose innerHTML should be updated with the XMLHttpRequest response text. |
| with | A Javascript expression specifying the parameters for the XMLHttpRequest. This defaults to 'value', which in the evaluated context refers to the new field value. |
ObserveField(String fieldId, Int32 frequency, String url, IDictionary options) : String
Observes the field with the DOM ID specified by fieldId and makes an Ajax when its contents have changed.
| Parameter | Description |
|---|---|
| fieldId | Form field to be observed |
| frequency | The frequency (in seconds) at which changes to this field will be detected. (required) |
| url | url for the action to call when the field has changed (required) |
| options | the options for the Ajax invocation |
ObserveField(IDictionary options) : String
Observes the field with the DOM ID specified by field and makes an Ajax call when its contents changes.
The following entries must exist in the dictionary:
field The DOM field to be observed url url to to call when the field has changed frequency The frequency (in seconds) at which changes to this field will be detected
The following are optional entries:
update Specifies the DOM ID of the element whose innerHTML should be updated with the XMLHttpRequest response text with A Javascript expression specifying the parameters for the XMLHttpRequest. This defaults to 'value', which in the evaluated context refers to the new field value
| Parameter | Description |
|---|---|
| options | the options for the Ajax invocation |
ObserveForm(String formId, Int32 frequency, String url, String idOfElementToBeUpdated, String with) : String
Works like the Castle.MonoRail.Framework.Helpers.AjaxHelper.ObserveField(System.String,System.Int32,System.String,System.String,System.String), but operates on an entire form identified by the DOM ID formId. Options are the same as Castle.MonoRail.Framework.Helpers.AjaxHelper.ObserveField(System.String,System.Int32,System.String,System.String,System.String), except the default value of the with option evaluates to the serialized (request String) value of the entire form.
| Parameter | Description |
|---|---|
| formId | Form to be observed |
| frequency | The frequency (in seconds) at which changes to this field will be detected. (required) |
| url | url for the action to call when the field has changed (required) |
| idOfElementToBeUpdated | Specifies the DOM ID of the element whose innerHTML should be updated with the XMLHttpRequest response text. |
| with | A Javascript expression specifying the parameters for the XMLHttpRequest. This defaults to 'value', which in the evaluated context refers to the new field value. |
ObserveForm(String formId, IDictionary options) : String
Like Castle.MonoRail.Framework.Helpers.AjaxHelper.ObserveField(System.String,System.Int32,System.String,System.String,System.String), but operates on an entire form identified by the DOM ID formId. options are the same as Castle.MonoRail.Framework.Helpers.AjaxHelper.ObserveField(System.String,System.Int32,System.String,System.String,System.String), except the default value of the with option evaluates to the serialized (request String) value of the entire form.
| Parameter | Description |
|---|---|
| formId | Form to be observed |
| options | the options for the Ajax invocation |
ObserveForm(IDictionary options) : String
Observes all elements within a form with the DOM ID specified by form and makes an Ajax call when its contents changes.
The following entries must exist in the dictionary:
form The form element id url url to to call when the field has changed frequency The frequency (in seconds) at which changes to this field will be detected
The following are optional entries:
update Specifies the DOM ID of the element whose innerHTML should be updated with the XMLHttpRequest response text with A Javascript expression specifying the parameters for the XMLHttpRequest. This defaults to 'value', which in the evaluated context refers to the new field value
| Parameter | Description |
|---|---|
| options | the options for the Ajax invocation |
PeriodicallyCallRemote(IDictionary options) : String
Periodically invokes the specified url. You can use the options to override the default frequency (defaults to 10 seconds).
| Parameter | Description |
|---|---|
| options | the options for the Ajax invocation |
PeriodicallyCallRemote(String url, IDictionary options) : String
Periodically invokes the specified url. You can use the options to override the default frequency (defaults to 10 seconds).
| Parameter | Description |
|---|---|
| url | url to be invoked periodically |
| options | the options for the Ajax invocation |
InputTextWithAutoCompletion(IDictionary options, IDictionary tagAttributes) : String
Rendes a input field with Google style autocomplete enabled. The specified url is used to gather the contents for the auto complete panel, so and your action should return filtered and sorted results.
The following entries must exist in the options:
input The text input element id url url to to call when the field has changed
it is assumed that the url invoked returns an unordered list.
| Parameter | Description |
|---|---|
| options | the options for the Ajax invocation |
| tagAttributes | attributes for the input html element |
InputTextWithAutoCompletion(String inputName, String url, IDictionary tagAttributes, IDictionary completionOptions) : String
Rendes a input field with Google style autocomplete enabled. The specified url is used to gather the contents for the auto complete panel, so and your action should return filtered and sorted results.
it is assumed that the url invoked returns an unordered list.
| Parameter | Description |
|---|---|
| inputName | input element id |
| url | url used to gather results |
| tagAttributes | attributes for the input element |
| completionOptions | options for the autocomplete |
AutoCompleteInputText(String elementId, String url, IDictionary options) : String
Generates an javascript block enabling auto completion for the specified input text id (elementId). You can specify the element to be updated using the options dictionary (key update), if you don't we assume elementId+autocomplete.
it is assumed that the url invoked returns an unordered list.
| Parameter | Description |
|---|---|
| elementId | The element id (input type=text) |
| url | The url to be invoked returning results |
| options | the options for the Ajax invocation |
BuildRemoteFunction(String url, IDictionary options) : String
Returns a function that makes a remote invocation, using the supplied parameters
| Parameter | Description |
|---|---|
| url | Target url |
| options | the options for the Ajax invocation |
RemoteFunction(IDictionary options) : String
Returns a function that makes a remote invocation, using the supplied parameters
| Parameter | Description |
|---|---|
| options | the options for the Ajax invocation |
BuildAjaxOptions(IDictionary jsOptions, IDictionary options) : String
Missing summary
| Parameter | Description |
|---|---|
| jsOptions | Missing documentation |
| options | Missing documentation |
BuildCallbackFunction(CallbackEnum callback, String code, String name) : String
Missing summary
| Parameter | Description |
|---|---|
| callback | Missing documentation |
| code | Missing documentation |
| name | Missing documentation |
BuildObserver(String clazz, String name, IDictionary options) : String
Missing summary
| Parameter | Description |
|---|---|
| clazz | Missing documentation |
| name | Missing documentation |
| options | Missing documentation |
GetOptions(String url, IDictionary options) : IDictionary
Missing summary
| Parameter | Description |
|---|---|
| url | Missing documentation |
| options | Missing documentation |
GetOptions(String url, String idOfElementToBeUpdated, String with, String loading, String loaded, String complete, String interactive) : IDictionary
Missing summary
| Parameter | Description |
|---|---|
| url | Missing documentation |
| idOfElementToBeUpdated | Missing documentation |
| with | Missing documentation |
| loading | Missing documentation |
| loaded | Missing documentation |
| complete | Missing documentation |
| interactive | Missing documentation |