We need to access the values of coach views within a Custom HTML view of a coach, but don't know how to do that. Unfortunately dojo.byId and dijit.byId does not returns the coach view by its Control Id general property.
Thanks in advance,
Pinned topic How to access coach view values within a HTML code?
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2012-10-10T17:44:21Z at 2012-10-10T17:44:21Z by LaszloKertesz
kolban 10000004463322 Posts
Re: How to access coach view values within a HTML code?2012-10-04T13:47:14ZThis is the accepted answer. This is the accepted answer.Hi Leslie,
I had a similar question before and after some discussions with folks I was led to believe that this is not the right thinking.
So .. imagine you have a Text Coach View bound to variable "XYZ". You now want some custom HTML that can also access XYZ and be told when it changes. If you create a new Coach View definition that contains HTML as well as a binding to XYZ then we will have achieved what you want.
If I may ask, what is it that you want to place into your Custom HTML in your specific instance? What is it (functionally) that your desired Custom HTML is going to do?
SystemAdmin 110000D4XK7615 Posts
Re: How to access coach view values within a HTML code?2012-10-04T14:26:50ZThis is the accepted answer. This is the accepted answer.
- kolban 1000000446
One is accessing coach view values from JS within a custom html tag all within the SAME coach view. An example being, if a coach view is bound to a variable then from within a custom html tag how can you access the bound variable? To access it from within one of the standard events (load, view.. ) you would use 'this.context.binding.get("value")' because the 'this' is the coach view object in these events.
The second scenario is what I believe Neil is addressing - accessing elements of one view coach from another. I would agree that in this scenario the right approach would be to either create the single coach view or work in a subscribe/consume event model pattern depending on the use case.
Re: How to access coach view values within a HTML code?2012-10-04T14:41:35ZThis is the accepted answer. This is the accepted answer.We don't want to make new coach views for all our forms where we need to check the relationships between the control values, just want to make one function that checks the validity of the entire form and prevent the post to the server and displays the error message in an alert window when there is any error.
For now we have the solution - we can call our function with an array that contains the Control Id and value for all the widgets on the form.
I think, this is the third way...
Anyway, thank you all for your replies!
Re: How to access coach view values within a HTML code?2012-10-10T17:44:21ZThis is the accepted answer. This is the accepted answer.Ok, finally we decided to use an outer coach view and access control data through that.
Thanks Neil, you're right, this is the best solution.