2

I just updated my local Xampp and a view remote sites from 3.4.1 to 3.4.2 and all (as far as I have tested) my custom components stopped being able to save, cancel form dialogs in the back end.

What I mean is the action buttons in the List views work. 'Add new item', 'Edit item' .. will load the forms, but then neither save, cancel will do anything!

  • The client validation is triggered, but nothing is forwarded after that.
  • NO php error
  • No Joomla error
  • No JS error ..

3.4.2 update only talks about minor security fixes!. ANY ideas?

I'm happy to post code, but at this point I have no idea which parts.

    JToolBarHelper::save('simplelist.save');
    JToolBarHelper::cancel('simplelist.cancel');

I checked with the Banner component, it doesn't look different from what I do, yet they are all still working

3 Answers 3

3

It turns out my problem was caused by the use of the onsubmit="" event at the form tag. NOTE: This is back-end code, I only have this problem when using the JToolBarHelper::buttons();

Here is what I used to do:

view.html.php

JToolBarHelper::save('simplelistitem.save');
JToolBarHelper::apply('simplelistitem.apply')

edit.php

<script>
    function extraValidationAAA(){ 
        if(jQuery('aa').val() === 'aaa'){ return true;} else {return false;}
    }
</script>

<form action=".." onsubmit="extraValidationAAA();" id='exampleForm' >
..
</>

This fails to submit my forms starting 3.4.2, even if valid. Taking a look at the com_banner / edit.php I tried using Joomla.submitbutton = function(){...}.

New edit.php

<script>
    var thisForm = document.getElementById("exampleForm");
    Joomla.submitbutton = function(task)    {
        if (task == "simplelistitem.cancel"){
           Joomla.submitform(task, thisForm );
        }
        else if (document.formvalidator.isValid(thisForm))
        {
            //add any additional validation here
            if(jQuery('aa').val() === 'aaa'){
                Joomla.submitform(task, thisForm );
            }
        }
    };
</script>

<form action=".."  id='exampleForm' >
..
</>

I lage the knowledge to explain why, nor do I know what changed in 3.4.2 to break my approach.

0

Joomla 3.4.2 has some known issues.

I'm not sure if it's related to yours, however they will be releasing Joomla 3.4.3 tomorrow, so I'd wait and install that update first.

8
  • I for sure did hold any updates. But I am still curious, it seems limited to JModelAdmin views, NOT jModelLists. I actually managed to get one local working in 3.4.2 by copying 3.4.1 over /into the 3.4.2, enter admin(working), delete all, copy original 3.4.2 files back in ...e voila. (don't do that at home kids!) So ya, good to know there is 3.4.3 on the way, Thanks
    – Andreas
    Jul 1, 2015 at 22:26
  • I'm going to accept this answer since it almost fixed the problem. Installing the 3.4.3 did work, but only after I went back to 3.4.1 first. Going from 3.4.2 to 3.4.3 did not do it. Just in case someone else runs into this
    – Andreas
    Jul 2, 2015 at 19:13
  • OK, this is getting wired, I'm uncheck the accept, since I was able to work it for a while, but now my toolbar buttons stopped functioning again
    – Andreas
    Jul 3, 2015 at 1:48
  • Could you please try installing a fresh copy of Joomla 3.4.3 in a separate folder, then installing your custom component. Would be interesting to see the outcome
    – Lodder
    Jul 3, 2015 at 7:26
  • I tried that, result nada. But I found out what it was. In short: I was using the forms onsubmit="" javascript event to do some custom validation. I tried reading the core.js source file, but there are to many ''soon to be deprecated" messages about the SubmitForm functions for me to make sense of it. I stopped using the OnSubmit and moved my code into Joomla.submitbutton = function(task) { ... } the same way it is done in other components like com_banner edit.php. Not sure why 3.4.2 broke my code now, it used to work fine. Wondering if I should write an answer outlining this?
    – Andreas
    Jul 4, 2015 at 0:21
0

Having the same issue, seems 3.4.x has changed the way you call the validation. https://docs.joomla.org/Client-side_form_validation

I changed JHTML::_('behavior.formvalidation'); to JHTML::_('behavior.formvalidator'); and replaced onsubmit="return doValidate( this );" with class="form-validate". Works as expected now, and the form no longer highlights the invalid form fields when you cancel/back out of the form (the form would still validate fields even when you were canceling the form edit using the old method).

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.