Advanced modules and javascript confusion

When I look at the cronjobs module I get really confused.
As far as I can tell there is somewhere a JS script that makes a button with an id of action reload the controllor. Is that correct? This script must also be ajax request, because in the controller the values are retrieved with a POST?

Where can I find this javascript, because in the assets of the cronjob folder there is only JS to delete a row. And more important is there any documentation about this?
Another question: what version of jqeury does the admin use? It seems like it is an old version because it does not recognise the .on method yet but only the older .click event. How can I change the Jquery file to the most recent?

I really like FUEL cms and I think it is amazing that you put this opensource, but I really hope that the documentation will get better. For some parts it is already quite good. But for example advanced modules are really hard to grasp without the available documentation. (could also be my lack of knowledge ;) )


  • edited 2:04PM
    Assuming you're meaning the saving of the jobs: Just looks like a normal POST/reload to me. Don't see any XHR requests.
    The input #action is on line #61 in the cronjobs view:
    <?=$this->form->hidden('action', $action)?>
    When you click the delete icon to the right of the action it's value is set by the js I think you've seen the CronjobsController.js file and the form is submitted.
    jQuery version is v1.5.1. Replace it in fuel/modules/fuel/assets/js/jquery/jquery.js
  • edited 2:04PM
    Thanks for your reply.
    You are right that it is a normal POST. I shoud have seen that. About the Jquery file I thought it was something else but that is probably because it is minified?
    I understand how the value in the hidden field is used to either delete or add a crontask. However I still don't how the a href submits the form.

    in CronjobsController.js the init methods calls three functions:

    init : function(initObj){ this._notifications(); this._submit(); this._super(initObj); }

    Does one of this do the job? And does anyone know where I could find them among all the .js files in the 'modules/fuel/assets/' folder.
    I ask this because I am really interested how this is done. Because I like the way it works.
  • edited April 2012
    No problem.

    The init function there is running/bringing into scope the BaseFuelController methods as defined in /modules/fuel/assests/js/fuel/controller/BaseFuelController.js

    To answer your question though, the form is being submitted with the plain old .submit() on those button clicks.

    This line:

    Just to be sure we're looking at the same thing, I see this:

    var CronjobsController = { init : function(initObj){ this._notifications(); this._submit(); this._super(initObj); }, cronjobs : function(){ $('.fillin').fillin(); $('#remove').click(function(e){ $('#action').val('remove'); $('#form').submit(); // here return false; }); $('.ico_remove_line').click(function(e){ $(this).parent().find('input').val(''); $('#form').submit(); // and here return false; }); } }; jqx.extendController(CronjobsController);
  • edited 2:04PM
    Okay I start to feel a little stupid now. The submit button has an id of submit but where do I find the:
    $("#submit").click(function(e) ............etc
  • edited 2:04PM
    That button will automatically submit the form without the need of javascript since it is a submit button.
  • edited 2:04PM
    Okay. Giving a href an id of 'submit' makes it a submit button. Learned something again. Sorry again for this slightly off topic discussion.
  • edited 2:04PM
    Oh sorry dude, I see what your asking now.. Yeah the cancel and submit buttons there are just links with an id of cancel and submit.

    In the init funcion above it has this._submit which is defined in the BaseFuelController file, it's this code:

    _submit : function(){ $('#submit').click(function(){ $('#form').submit(); return false; }); },

    Theres the click function you were asking about.
Sign In or Register to comment.