In my custom widget html I have:
<buton class="esri-button">
<form enctype="multipart/form-data" method="POST"
data-dojo-attach-point="uploadForm">
<input type="file" name="file" accept=".zip,.rar,.7zip"
data-dojo-attach-point="inFile" />
</form>
</buton>
in my widget (startup or onOpen) I have:
on(this.uploadForm, "change", lang.hitch(this, function (event) {
...
}));
It works fine, but if I activates it second time on SAME input file, the code inside the "on" callback is not entered at all...
I assume it's since the "change" event has not occurred since it remembers the previous file.
Am I right?
Can I detect it and present a warning (either by html or by javascript)?
Help will be greatly appreciated,
Michael
Solved! Go to Solution.
That is a javascript Question you have.. not really ESRI ArcGIS JS related. So you should review javascript topics to do the warning part. May be this below link will guide -> https://stackoverflow.com/questions/12030686/html-input-file-selection-event-not-firing-upon-selecti...
And if you have further questions on it.. you should post to stackoverflow javascript forum probably.
Hi Michael Lev,
You are correct. Just ensure the event handler is not disabled or changed in any other part of your code. You seem to be programmatically attaching the onchange event, that’s why I say that.
You may need another button /mechanism to call a validation method. To check if the file path is changed and to produce your warning related logic.. as the code you have shared indicates only onChange handler.
Thank You!
Dear Harish Palaniappan,
Thank you for replying!
I don't know how to create warning if the user operates again on same file.
So what I did, since I don't want that if the user tries to act again on same file, nothing will happen without telling him the reason, so I always present text telling the user he can't operate again on same file unless clicking another "Clear" button to clear "inFile".
Please -
I'll appreciate your help, since I'm not so familiar with that area.
Michael
That is a javascript Question you have.. not really ESRI ArcGIS JS related. So you should review javascript topics to do the warning part. May be this below link will guide -> https://stackoverflow.com/questions/12030686/html-input-file-selection-event-not-firing-upon-selecti...
And if you have further questions on it.. you should post to stackoverflow javascript forum probably.
Dear Harish Palaniappan,
Thank you very much!
Both for showing how to search solution for such cases, and for pointing to link that showed me the way to go - I just automatically cleared "inFile" value after each time I have completed handling it.
Michael