dstromberg
Coder
Hello people.
I currently have a (I think) pure CSS button that toggles between "PRESERVED" and "NOT PRESERVED". That's been good enough 'til now, even though infrequently the button will change but the underlying state doesn't, resulting in a button that has the wrong value (IOW, "PRESERVED" when it should be "NOT PRESERVED", or vice-versa).
But now we have some additional validation that will frequently have us not wanting to toggle between "PRESERVED" and "NOT PRESERVED" - IOW when the button actually should continue to say (or return to saying) "NOT PRESERVED".
The web site is internal-only, so I can't really give a URL, but I half-think the current pure CSS button is described at https://codepen.io/planetXD/pen/mEbaBo (it was originally added to our internal website by someone who is no longer with the company).
The HTML currently looks like:
If I set a breakpoint in vm.UpdatePreserveStatus, then the button toggles before the first line of vm.UpdatePreserveStatus is executed - that is, it's processing the button click, not deciding whether the button click should be allowed to happen.
I don't think we want to just gray out the button, unless perhaps there's some way of putting a tooltip over the grayed button describing why it shouldn't be used right now.
Is there a way I can validate the toggle button, only toggling if a javascript function believes it should toggle? Or alternatively, is there a way I can toggle the button irrespectively, but then change it back if there's a bad validation? Or the gray+tooltip option?
Thanks!
I currently have a (I think) pure CSS button that toggles between "PRESERVED" and "NOT PRESERVED". That's been good enough 'til now, even though infrequently the button will change but the underlying state doesn't, resulting in a button that has the wrong value (IOW, "PRESERVED" when it should be "NOT PRESERVED", or vice-versa).
But now we have some additional validation that will frequently have us not wanting to toggle between "PRESERVED" and "NOT PRESERVED" - IOW when the button actually should continue to say (or return to saying) "NOT PRESERVED".
The web site is internal-only, so I can't really give a URL, but I half-think the current pure CSS button is described at https://codepen.io/planetXD/pen/mEbaBo (it was originally added to our internal website by someone who is no longer with the company).
The HTML currently looks like:
HTML:
Preserve Build<br />
<div ng-if="!vm.updatingStatus" class="onoffswitch onoffswitch-build-preserve">
<input type="checkbox" id="onoffswitch-build-preserve" name="onoffswitch-build-preserve" class="onoffswitch-checkbox"
ng-change="vm.UpdatePreserveStatus()"
ng-model="build.preserved"
ng-false-value="false"
ng-true-value="true">
<label class="onoffswitch-label" for="onoffswitch-build-preserve">
<span class="onoffswitch-inner onoffswitch-inner-build-preserve"></span>
<span class="onoffswitch-switch"></span>
</label>
</div>
<div ng-if="vm.updatingStatus">
<span class="spinner-40-battlenet"></span>
</div>
If I set a breakpoint in vm.UpdatePreserveStatus, then the button toggles before the first line of vm.UpdatePreserveStatus is executed - that is, it's processing the button click, not deciding whether the button click should be allowed to happen.
I don't think we want to just gray out the button, unless perhaps there's some way of putting a tooltip over the grayed button describing why it shouldn't be used right now.
Is there a way I can validate the toggle button, only toggling if a javascript function believes it should toggle? Or alternatively, is there a way I can toggle the button irrespectively, but then change it back if there's a bad validation? Or the gray+tooltip option?
Thanks!