Freitag, 13. Januar 2012

Taming the button, attr disabled...

I had to change my basic approach due to a much easier way to control the execution of the onclick action. Thanks for the hint Dan. I'm very certain, that I tried something like that before, but it looks like I made a mistake. Anyway....

The new approach is based on two things
  1. The css class apex_disable to control the layout and  
  2. The attribute disabled to control the onClick event
I use CSS files and adapted templates to control the layout of different themes. This has not changed and can be found in my last postings. You only have to add the disabled attribute to the Button Disabled template to make it work.

I use a custom shared javascript file called (you may already have guessed that...) Custom.js to store the very simple scripts to enable and disable elements.

 * Custom.js
 * Author: Martin M.
 * use on your own risk
 * Date: 2012/01/13
 function disableElement(name){
   $(name).attr('disabled', 'disabled');
 function enableElement(name){

Upload the file as shared Component => Static File and add the line

<script src="#WORKSPACE_IMAGES#Custom.js" type="text/javascript"></script>

to the header of the page template(s) you want to use to make the code available on all pages.

Custom.js, ThemesAdmin_3.sql, DisableButtonExample_5.sql

Unfortunately... when I switched back to Theme Crimson - 23... :( But that is another story!

To be continued...

Keine Kommentare:

Kommentar veröffentlichen