Jpopmessages - no popup for field validation error

More
5 years 10 months ago #339 by giro
giro replied the topic: Jpopmessages - no popup for field validation error
Hi,
the problem is due to the way your messages are injected into the page.
jPopmessages retrieves the messages after the page load is completed, then it does the popup.
in your case there is no message at the page load, because the messages are added AFTER the page load and using javascript.
so the only solution is to manually trigger the jPopmessages AFTER the messages are added into the page using the following simple function: "jpopmessages();"
A simple but dirty way to do it, is to just add the following to your submit button in the form: onclick="jpopmessages();"
so the button would be:
<button class="button validate" type="submit" aria-invalid="false" onclick="jpopmessages();">Wyƛlij</button>
The following user(s) said Thank You: metmusic

Please Log in or Create an account to join the conversation.

  • metmusic
  • metmusic's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 10 months ago #340 by metmusic
metmusic replied the topic: Jpopmessages - no popup for field validation error
Thanks for tip but... It didn't fixed my issue :/

Please Log in or Create an account to join the conversation.

More
5 years 10 months ago #341 by giro
giro replied the topic: Jpopmessages - no popup for field validation error
I tested, it works for me, at least in FF latest release.
the best way to fix it, is to add the jpopmessages(); AFTER the javascript code involved in the injection of the messages. in that way you'll be sure to trigger the jpopmessages after the messages have been added into the page.

Please Log in or Create an account to join the conversation.

  • metmusic
  • metmusic's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 10 months ago #342 by metmusic
metmusic replied the topic: Jpopmessages - no popup for field validation error
Can you see my source code now?
I've modified template file containing this button:
<button class="button validate" type="submit" onclick="jpopmessages();"><?php echo JText::_('COM_JOOMFAQ_FORM_SUBMIT'); ?></button>

Please Log in or Create an account to join the conversation.

More
5 years 10 months ago #343 by giro
giro replied the topic: Jpopmessages - no popup for field validation error
as I told you, the best way is to trigger the jpopmessages after the messages are added into the page.
on the "onclick" event the messages are not added into the page yet, so you should find where is the javascript code that add the messages, or just a quick fix but very very very dirty code would be to DOUBLE trigger the button click, for example wiht this:

onclick="jQuery(this).trigger('click'); jpopmessages();"

that would works, but that's not the way to write a solid and clean code.

Please Log in or Create an account to join the conversation.

  • metmusic
  • metmusic's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 10 months ago - 5 years 10 months ago #344 by metmusic
metmusic replied the topic: Jpopmessages - no popup for field validation error
Hello,

Unfortunately this dirty code also not works :/ Now my button looks like this :
<button class="button validate" type="submit" onclick="jQuery(this).trigger('click'); jpopmessages();"><?php echo JText::_('COM_JOOMFAQ_FORM_SUBMIT'); ?></button>

Following script is added into <head> </head>block only on this particular page:
<script type="text/javascript">
    (function() {
      var strings = {"JLIB_FORM_FIELD_INVALID":"Niepoprawne pole:&#160"};
      if (typeof Joomla == 'undefined') {
        Joomla = {};
        Joomla.JText = strings;
      }
      else {
        Joomla.JText.load(strings);
      }
    })();
  </script>

also (empty) message container is in the place before showing messages (joomla standard):
<div id="system-message-container">
	</div>
Last Edit: 5 years 10 months ago by metmusic.

Please Log in or Create an account to join the conversation.

Fork me on GitHub
Cookies make it easier for us to provide you with our services. With the usage of our services you permit us to use cookies.
More information Ok