How do I flag a change from a custom forms control

Topics: General
Oct 27, 2011 at 3:50 PM

I am wondering how to flag a change to an edit form from an user control. 

I have a custom user control that inherits from UserControlBasedUiControl that is being shown within a FieldGroup.  On my UserControl there is a drop down list that is bound and unbound via a property on the user control.  Everything is saving properly if I can get the save button to be enabled by editing another piece of information on one of the more standard composite controls.  How can I make the form aware when a change is made on my custom user control so that I can initiate the save post?


Oct 28, 2011 at 12:11 AM
I include at the top of my page an asp literal control:
<asp:Literal ID="BindingActioner" runat="server" />
When I need the save button enabled, I will set the text of that literal:
BindingActioner.Text = "<ui:binding onattach=\"this.dispatchAction(Binding.ACTION_DIRTY);\" />";
There is a corresponding call to make the client clean again:
BindingActioner.Text = "<ui:binding onattach=\"this.dispatchAction(Binding.ACTION_CLEAN);\" />";

Oct 28, 2011 at 3:36 PM

This is helpful, however I am wondering what other ways I could gain access to the dispatchAction method via client side script? 

Oct 28, 2011 at 4:57 PM

oh, thats easy :) If its a custom .aspx page, then follow these steps to make it a "proper" c1 console page If its a usercontrol embedded in an existing page/dynamic typeform you should be all set.

Now you have access to the whole javascript client of C1 console and here you would just write this small snippet of javascript


var binding = window.bindingMap.yourPageId;
binding.dispatchAction ( Binding.ACTION_CLEAN );

where yourPageId is defined with the <ui:page> tag like this 

<ui:page id="yourPageId">


Oct 28, 2011 at 6:04 PM

This is great thanks.  I also found you could use something like...

var key = $('editorpage').attr('key'); 
Thank you again both for your help.