Resco JavaScript Bridge: Difference between revisions

Jump to navigation Jump to search
 
Line 1,361: Line 1,361:
In this section, we explain some basic operations. The object that we use can be found on this reference page:
In this section, we explain some basic operations. The object that we use can be found on this reference page:


* Basic questionnaire form object: https://github.com/Resconet/JSBridge/wiki/MobileCRM.UI.QuestionnaireForm
* Basic questionnaire form object: [https://github.com/Resconet/JSBridge/wiki/MobileCRM.UI.QuestionnaireForm MobileCRM.UI.QuestionnaireForm]
* Questionnaire group: https://github.com/Resconet/JSBridge/wiki/MobileCRM.UI.QuestionnaireForm.Group
* Questionnaire group: [https://github.com/Resconet/JSBridge/wiki/MobileCRM.UI.QuestionnaireForm.Group MobileCRM.UI.QuestionnaireForm.Group]
* Question: https://github.com/Resconet/JSBridge/wiki/MobileCRM.UI.QuestionnaireForm.Question
* Question: [https://github.com/Resconet/JSBridge/wiki/MobileCRM.UI.QuestionnaireForm.Question MobileCRM.UI.QuestionnaireForm.Question]


Methods can be found in the section with '''Functions'''. We explain the basic handlers like onSave, onChange, and requestObject (i.e. onLoad).
Methods can be found in the section with '''Functions'''. We explain the basic handlers like onSave, onChange, and requestObject (i.e. onLoad).
Line 1,404: Line 1,404:


References:
References:
* https://github.com/Resconet/JSBridge/wiki/MobileCRM.UI.QuestionnaireForm.findQuestionById
* [https://github.com/Resconet/JSBridge/wiki/MobileCRM.UI.QuestionnaireForm.findQuestionById   MobileCRM.UI.QuestionnaireForm.findQuestionById]
* https://github.com/Resconet/JSBridge/wiki/MobileCRM.UI.QuestionnaireForm.findGroupByName
* [https://github.com/Resconet/JSBridge/wiki/MobileCRM.UI.QuestionnaireForm.findGroupByName   MobileCRM.UI.QuestionnaireForm.findGroupByName]
* https://github.com/Resconet/JSBridge/wiki/MobileCRM.UI.QuestionnaireForm.findQuestionByName
* [https://github.com/Resconet/JSBridge/wiki/MobileCRM.UI.QuestionnaireForm.findQuestionByName MobileCRM.UI.QuestionnaireForm.findQuestionByName]


If we get the group, we can set the property of this object. In our case, we disable the whole group. You can set the visibility of the group as well. We can also set these properties on the question if it's available. We changed the description. In the application, it looks like this.
If we get the group, we can set the property of this object. In our case, we disable the whole group. You can set the visibility of the group as well. We can also set these properties on the question if it's available. We changed the description. In the application, it looks like this.
Line 1,414: Line 1,414:
==== Work with handlers ====
==== Work with handlers ====


A simple onChange handler sets an error message and validation on specific question.  
A simple onChange handler sets an error message and validation on a specific question.  


<syntaxhighlight lang='js'>
<syntaxhighlight lang='js'>
Line 1,435: Line 1,435:
</syntaxhighlight>
</syntaxhighlight>


An important part of the code is in the second and third lines. They show how to access the changed item. Anytime a question changes, this handler triggers. Therefore, it is good to know how to determine what question has been changed.
The second and third lines of the code are important because they show how to access the changed item. This handler triggers any time a question changes. Therefore, it is good to know how to determine what question has been changed.


The last part shows how to set the property validation and custom error message for the changed item, if the value was set to false. In the application, it looks like this.
The last part shows how to set the property validation and custom error message for the changed item if the value was set to false. In the application, it looks like this.


The error message is displayed when a user attempts to close the form.
The error message is displayed when a user attempts to close the form.

Navigation menu