General discussion
Loading icon when Register Success

For Example if we use page


https://codologic.com/forum/index.php?u=/user/forgot


or some others, we have that code after Submit button


<button id='req_pass' class='codo_btn codo_btn_primary'>{_t('E-mail reset token')}</button>
<img id="codo_sending_mail" style="display: none" src="{$smarty.const.CURR_THEME}img/ajax-loader.gif" />

So the goal is to add "codo_sending_mail" for Register page, because waiting on this page takes the maximum time.


What I do?


First add the code after Submit button
<img id="codo_sending_mail" style="display: none" src="{$smarty.const.CURR_THEME}img/ajax-loader.gif" />
to ....\sites\default\themes\default\templates\user\register.tpl


Then edit some code to ....\sites\default\assets\js\user\register.js


$('#codo_register').on('click', function() {

if (error_exists(register.errors)) {
$('#reg_username').focus();
return false;
} else {
$('#codo_sending_mail').show();
$(this).submit();
}
});

But the logic is not what we need, as loading button appears on first click at Submit button.


So return to page ...\sites\default\themes\default\templates\user\register.tpl


and add this code to each Input


onclick="$('#codo_sending_mail').hide();"

635636d8215e6


I do not like this solution, you understand why, help to implement this function beautifully. Thanks


For Example if we use page https://codologic.com/forum/index.php?u=/user/forgot or some others, we have that code after Submit button ```` &lt;button id=&#039;req_pass&#039; class=&#039;codo_btn codo_btn_primary&#039;&gt;{_t(&#039;E-mail reset token&#039;)}&lt;/button&gt; &lt;img id=&quot;codo_sending_mail&quot; style=&quot;display: none&quot; src=&quot;{$smarty.const.CURR_THEME}img/ajax-loader.gif&quot; /&gt; ```` So the goal is to add &quot;codo_sending_mail&quot; for Register page, because waiting on this page takes the maximum time. What I do? First add the code after Submit button &lt;img id=&quot;codo_sending_mail&quot; style=&quot;display: none&quot; src=&quot;{$smarty.const.CURR_THEME}img/ajax-loader.gif&quot; /&gt; to ....\sites\default\themes\default\templates\user\register.tpl Then edit some code to ....\sites\default\assets\js\user\register.js ```` $(&#039;#codo_register&#039;).on(&#039;click&#039;, function() { if (error_exists(register.errors)) { $(&#039;#reg_username&#039;).focus(); return false; } else { $(&#039;#codo_sending_mail&#039;).show(); $(this).submit(); } }); ```` But the logic is not what we need, as loading button appears on first click at Submit button. So return to page ...\sites\default\themes\default\templates\user\register.tpl and add this code to each Input ```` onclick=&quot;$(&#039;#codo_sending_mail&#039;).hide();&quot; ```` ![635636d8215e6](serve/attachment&amp;path=635636d8215e6) I do not like this solution, you understand why, help to implement this function beautifully. Thanks

Hallo @djonwick

It's really great of you to look at and test everything so closely. However, I would like to save you from a great disappointment. If you change the code on Theme View Files or Theme CSS , JS Files and then make your own theme out of it, then everything is fine.


However, if you change source files, i.e. not theme files from Codoforum, it is possible that all your work will be overwritten with the next update.


To be absolutely sure and also to be able to be sure that the PHP version is not to blame for the errors you report, it would be good if you run Codoforum with PHP 8 or PHP 8.1. You are using a 7.4 version.


Kind regards and thanks for all the info.


WebCrew smile


Hallo @djonwick It&#039;s really great of you to look at and test everything so closely. However, I would like to save you from a great disappointment. If you change the code on Theme View Files or Theme CSS , JS Files and then make your own theme out of it, **then everything is fine.** However, **if you change source files**, i.e. not theme files from Codoforum, it is possible that all your work **will be overwritten with the next update**. To be absolutely sure and also to be able to be sure that the PHP version is not to blame for the errors you report, it would be good **if you run Codoforum with PHP 8 or PHP 8.1.** You are using a 7.4 version. Kind regards and thanks for all the info. WebCrew ;)

https://net-twin.de/ Community for creative people - JOIN it Now please
https://github.com/WebCrew My GitHub account
https://sell-co.de/ Lots of Web-Tools and Utilities for free

Hi


As @WebCrew pointed out if you are on a lower version of PHP, I strongly recommend you to use PHP 8 for running latest version of codoforum. Some features may simple break if you use it on a lower version

As for the loading icon, its more suitable if we make it as part of the core. You implementing this would mean you would have to write a plugin for a simple change as this because otherwise your custom changes would get overwritten by next upgrade.


We have added this to our todo list so it will be part of the next release.


Hi As @WebCrew pointed out if you are on a lower version of PHP, I strongly recommend you to use PHP 8 for running latest version of codoforum. Some features may simple break if you use it on a lower version As for the loading icon, its more suitable if we make it as part of the core. You implementing this would mean you would have to write a plugin for a simple change as this because otherwise your custom changes would get overwritten by next upgrade. We have added this to our todo list so it will be part of the next release.
Necessity is the mother of all inventions!

okay, done it!smile


....\sites\default\assets\js\user\register.js


need to change this code


if (error_exists(register.errors)) {
$('#reg_username').focus();
return false;
} else {
$(this).submit();
}

to


if (error_exists(register.errors)) {
$('#reg_username').focus();
return false;
} else {
var
usernamech = $.trim($('#reg_username').val()),
passch = $.trim($('#password').val()),
mailch = $.trim($('#reg_mail').val());
if (usernamech.length > 0 && passch.length > 0 && mailch.length > 0) {
$('#codo_sending_mail').show();
}
$(this).submit();
}

and add this code to each Input


onclick="$('#codo_sending_mail'smile.hide();"


And no need for that already!


This is for you @admin

You've forgotten some code for check


636248432fabe


okay, done it!8) ....\sites\default\assets\js\user\register.js need to change this code ```` if (error_exists(register.errors)) { $(&#039;#reg_username&#039;).focus(); return false; } else { $(this).submit(); } ```` to ```` if (error_exists(register.errors)) { $(&#039;#reg_username&#039;).focus(); return false; } else { var usernamech = $.trim($(&#039;#reg_username&#039;).val()), passch = $.trim($(&#039;#password&#039;).val()), mailch = $.trim($(&#039;#reg_mail&#039;).val()); if (usernamech.length &gt; 0 &amp;&amp; passch.length &gt; 0 &amp;&amp; mailch.length &gt; 0) { $(&#039;#codo_sending_mail&#039;).show(); } $(this).submit(); } ```` [quote=&quot;pid:26122, uid:15112&quot;]and add this code to each Input onclick=&quot;$(&#039;#codo_sending_mail&#039;).hide();&quot;[/quote] And no need for that already! This is for you @admin You&#039;ve forgotten some code for check ![636248432fabe](serve/attachment&amp;path=636248432fabe)

Thanks for looking into this. We will update what is missing in the code.


Thanks for looking into this. We will update what is missing in the code.
Necessity is the mother of all inventions!
64
4
3
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft