In Dojo, How to check that the button is already clicked or not. Here I need to do different task if button is clicked. For that I am using the following piece of code, but it is not working:
<form data-dojo-type="dijit/form/Form"
data-dojo-id="customerIdSelector" id="customerIdSelector"
method="post" action="/ritl/chart/iCustomerBaseEntryBarChart.htm">
<table >
===========
// Other components
===========
<button data-dojo-type="dijit/form/Button" id="buttonOne" type="n">
<div class="ri-ok">Generate Graph</div>
<script type="dojo/method" data-dojo-event="onClick"data-dojo-args="evt">
</button>
if(buttonOne.onClick == true)
// if(event.type == onClick)
{
alert('onclick');
functionToCall();
}
else {
alert('not clicked');
return false;
}
===========
</table>
</form>
inside if()
, what condition should be passed to check click event?
I am answering to affirm Dimitri's response in the OP's question. A Button Dijit is stateless so you would need a global variable or an element in the DOM to hold the state. However, you could just use a toggle button
You can get it's state by using dijit/registry:
registry.byId('buttonOne').get('checked')