LnkWcb Framework

LnkWcb  2.5.0

LnkWcb Framework > LnkWcb > LnkWcb.BoutonJquery
Search:
 
Filters

Class LnkWcb.BoutonJquery - extends LnkWcb.Bouton

Advanced Bouton

Constructor

LnkWcb.BoutonJquery ( cfg )
Parameters:
cfg <Object> the initial configuration settings

Properties

rsc - Object

The current resource used.

Properties inherited from LnkWcb.Bouton:

cfg

Methods

onChannelStateAction

protected void onChannelStateAction ( etat , etatOuverture )
The default listener action for the onChannelState event.

Override this method to change the default behavior.

Calls the showUserStatus method with the formated msg.helloChannelState message from the resource.

Parameters:
etat <Object> the server response
etatOuverture <String> a digest channel status (recommended)

onEndedAction

protected void onEndedAction ( status , params )
The default listener action for the onEnded event.

Override this method to change the default behavior.

Calls the showUserStatus method with the formated message from the resource.

  • msg.delayedCallAccepted in case of an accepted delayed call
  • msg.okThanks in case the call ends with an OK final status
  • The formated msg.koPleaseCallLater message in case of a KO ending
If the KO ending was caused by the websurfer, then the showUserErrors method is called instead.
Parameters:
status <Object> the response object
params <Object<Array<String>>> the request parameters

onErrorDigestAction

protected void onErrorDigestAction ( msgCode , errCode , status , params )
The default listener action for the onErrorDigest event.

Override this method to change the default behavior.

Calls the showUserStatus method with the formated message from the resource. When the KO ending was caused by the websurfer, then the showUserErrors method is called instead.

Parameters:
msgCode <String> a message code for the error
errCode <String> an error code for the error
status <Object> the response object
params <Object<Array<String>>> the request parameters

onFallbackAction

protected void onFallbackAction ( status , params )
The default listener action for the onFallback event.

Override this method to change the default behavior.

Calls the showUserStatus method with the formated message from the resource.

Parameters:
status <Object> the response object
params <Object<Array<String>>> the request parameters

onStatusAction

protected void onStatusAction ( status , params )
The default listener action for the onStatus event.

Override this method to change the default behavior.

Calls the showUserStatus method with the formated msg.callStatus message from the resource.

Parameters:
status <Object> the response object
params <Object<Array<String>>> the request parameters

resetUserErrors

protected void resetUserErrors ( )
Empty the user error element.

showUserErrors

protected void showUserErrors ( errors )
Display errors. They are strings, grouped in arrays, indexed by their field CSS (relative) selectors.

A <ul> list is created into the user error element. Each string is put into an <li> item of this list.

The names in the errors arguments actually are CSS selectors (relative to the form root specified by the formSel) to find some element on which the error CSS class (see the errorClass config) will be added.

Parameters:
errors <Object<Array<String>>>

showUserStatus

protected void showUserStatus ( msg )
Display a text message into the user status element. The one specified with the userStatusElemRelSel config.
Parameters:
msg <String> the text message to display

validator

private Boolean validator ( telephone , date )
The default validator for this LnkWcb.BoutonJquery class.

If some error is detected, the showUserErrors method is called.

Parameters:
telephone <String> the callee telephone number
date <Date> an optional date at which the delayed call should occur
Returns: Boolean
true if inputs are valid, false otherwise

Events

onCreate

protected static onCreate ( bouton )
Class event. Fires when an LnkWcb.BoutonJquery instance is just created.
Parameters:
bouton <Object> the new instance

Configuration Attributes

calleeInputRelSel - String

The relative CSS selector that locates the websurfer input element for his/her telephone number. Relative to the form root as specified by formSel. Might not necessarily be an <input> element. It can be a container that will be highlighted (see errorClass config) on error.
Default Value: input[name="callee"]

dateInputRelSel - String

The relative CSS selector that locates the websurfer input element for the date at which the delayed call is to be planned. Relative to the form root as specified by formSel. Might not necessarily be an <input> element. It can be a container that will be highlighted (see errorClass config) on error.
Default Value: .LnkWcbDateDiff

errorClass - protected String

The CSS class that will be added to input elements when they are in error state.
Default Value: error

formSel - String

A CSS selector that locates the form container. This container element might not necessarily be a <form> element. It is just a root element in which other elements will be looked for.
Default Value: #LnkWcbForm

userErrorsElemRelSel - String

The relative CSS selector that locates the websurfer errors element. Relative to the form root as specified by formSel.
Default Value: .user-errors

userStatusElemRelSel - String

The relative CSS selector that locates the websurfer status element. Relative to the form root as specified by formSel.
Default Value: .user-status


Copyright © 2010 Linkeo.com All rights reserved.