Joomla 5 Notice

We are pleased to announce that as of January 29, 2024, all of our Joomla extensions are compatible with Joomla 5.

For all who are still updateing from Joomla 3 to Joomla 4: Joomla 4 Migration instructions are available here:

There is now a separate Documentation for Visforms for Joomla 4 and for Visforms for Joomla 5!

Forum

Visforms Subscription user can ask questions in our forum. Please log in with the relevant user first.
Everybody can access the forum for reading.

Please only ask 1 question per topic.

Important information for almost every question:
V1: Which Visforms version is running?
V2: Which Joomla version is running?
V3: Which PHP version is running?

Logged in users only

More
10 years 2 months ago #812 by themeindia.org
Logged in users only was created by themeindia.org
Hi,
I want my form to show to all so that they know what the form is all about, but they are not allowed to post the messages unless they are logged in. Is that kind of validation already there in the "Submit" button?

Thank you in anticipation

themeindia.org: A not-for-profit online community.

More
10 years 2 months ago #814 by Administrator AV
Replied by Administrator AV on topic Logged in users only
Hi,

sorry but no, that is not possible out of the box.

Regards,
Aicha

:idea: I recommend you the new and up-to-date documentation for Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/en/docs/
Most of this also applies retrospectively to Joomla 3.
Please only ask 1 question per topic :-).

:idea: Ich empfehle Dir die neue und aktuelle Dokumentation für Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/docs/
Das meiste gilt rückwirkend auch für Joomla 3.
Bitte immer nur 1 Frage pro Thema stellen :-).

More
10 years 2 months ago - 10 years 2 months ago #816 by themeindia.org
Replied by themeindia.org on topic Logged in users only
Hi,
Do you think the code below is enough for that kind of validation ?
Code:
if ( JFactory::getUser()->guest) { echo “Please login to submit.”; } else { // process the submit event }
If yes where exactly should I put them?
Thank you.

P.S. Most of the times I am having trouble logging in this forum. It says 'It seems you are a spammer etc......" and won't allow me to login and sometimes it works just fine.

themeindia.org: A not-for-profit online community.
Last edit: 10 years 2 months ago by themeindia.org.

More
10 years 2 months ago #817 by Administrator AV
Replied by Administrator AV on topic Logged in users only
Hi,

first, I use a spam protection software and I can see that your IP, although it seems to change daily, often is listed as a spammer IP at the spambot database of sorbs.net. That is, why your login is blocked. I have set you as a trusted user, so you should no longer be blocked, no matter your IP.

I think your code proposition is ok. The best way to use it would be to create an override of the default form view in your template. (Create a folder html/com_visforms/visforms in your template root folder and copy the default.php from components/com_visforms/views/visforms/tmpl intot it).

Add your code to that copied default.php in the template folder. Almost at the bottom of the default.php (about line 465) you find a div class="visBtnCon, which is closed about line 500. Wrap the whole div in your "else" statement and you have a form without submit button for guest users. So you will not stop the submit event but just don't offer a submit button, so that the form cannot be submitted.

Regards,
Aicha

:idea: I recommend you the new and up-to-date documentation for Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/en/docs/
Most of this also applies retrospectively to Joomla 3.
Please only ask 1 question per topic :-).

:idea: Ich empfehle Dir die neue und aktuelle Dokumentation für Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/docs/
Das meiste gilt rückwirkend auch für Joomla 3.
Bitte immer nur 1 Frage pro Thema stellen :-).

More
10 years 2 months ago - 10 years 2 months ago #818 by themeindia.org
Replied by themeindia.org on topic Logged in users only
Thank you Aicha,

Yes our ISP provides dynamic IP everytime you login. I have no idea how sorbs.net works but this state owned ISP is one of the largest in the world with 8.09 million subscribers base at the moment.

My form in question is embeded with an article as a module so in my case I created a folder html/mod_visforms/ in my root template folder and copied default.php from modules/mod_visforms/tmpl in it.

Unfortunately that's my exact requirment at the moment, i.e. hold the processing of submit event until the user is logged in. On clicking submit button the user will be warned " You are not logged in" or "Please login to submit" if they are not logged in yet.

Your guidance in this regard will be highly appreciated.

themeindia.org: A not-for-profit online community.
Last edit: 10 years 2 months ago by themeindia.org.

More
10 years 2 months ago - 10 years 2 months ago #820 by Administrator AV
Replied by Administrator AV on topic Logged in users only
Hi,

in the default.php at line 118 ff you find the following code
Code:
var validator = jQuery(document).ready(function() { jQuery('#mod-visform<?php echo $visforms->id; ?>').validate({ wrapper: "p",

Just insert the following lines between the second and the third line (before the "wrapper" - line).
Code:
submitHandler: function(form) { <?php if (JFactory::getUser()->guest) { ?> alert('Please login in submit the form'); <?php } else { ?> form.submit(); <?php } ?> },

The only drawback in my opion is, that the submitHandler is executed after the validator. So the user will fill in the form, correct all there invalid inputs, try to submit and gets the message to login first. After the login the form controls are empty again, so they have to enter the values again.

But maybe you can improve that solution by reading a bit more about the jQuery validator plugin.

Regards,
Aicha

:idea: I recommend you the new and up-to-date documentation for Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/en/docs/
Most of this also applies retrospectively to Joomla 3.
Please only ask 1 question per topic :-).

:idea: Ich empfehle Dir die neue und aktuelle Dokumentation für Joomla 4:
docs.joomla-5.visforms.vi-solutions.de/docs/
Das meiste gilt rückwirkend auch für Joomla 3.
Bitte immer nur 1 Frage pro Thema stellen :-).
Last edit: 10 years 2 months ago by Administrator AV. Reason: Misspelling corrected

Moderators: Administrator AVAdministrator IV
Powered by Kunena Forum