• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Hide joomla reg required fields conditionally

Hide joomla reg required fields conditionally 9 years 8 months ago #28456

  • info3946
  • info3946's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 18
  • Thank you received: 1
Hi I have a form which silently registers a joomla user.
The form has the usual username, password, email fields which are mapped
The problem is that some users are already registered on the site and cannot therefore fill out the form.
Is it possible to
1. Hide the username / pass fields if a user is logged in and capture the email field dynamically
2. Use conditional fields to hide the username and password fields if a user has not registered previously

Currently using conditional fields the form still asks for input on the hidden fields.

Thanks for any help
The administrator has disabled public write access.

Hide joomla reg required fields conditionally 9 years 8 months ago #28458

  • cosmin.cristea
  • cosmin.cristea's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 756
  • Thank you received: 144
You can approach your scenario in the following way. Grab the username/email using the method provided in the documentation :
http://www.rsjoomla.com/support/documentation/view-article/77-display-php-variables-by-default-when-form-is-shown.html

Next step would be to create a script that checks it's value so it can hide the unwanted fields.

Keep in mind this is an example and not a solution.

Insert this in the default value of the username field:
//<code>
$user = JFactory::getUser();
return $user->get('username')
//</code>

Head over to CSS and Javascript section and insert a code like the following (you will need jQuery):
<script>
jQuery( document ).ready(function() {
	if (jQuery("#name_of_username_field").val().length > 0){
		jQuery( ".class_of_the_username_field" ).hide();
	}
});
</script>

Next thing on the list is to stop the mapping from happening, in the scripts called after form process, insert the following code:
if ($user->get('id') > 0) {
	$mappings = array();
}
My help is not official customer support. To receive your support, submit a ticket by clicking here
Last Edit: 9 years 7 months ago by cosmin.cristea.
The administrator has disabled public write access.

Hide joomla reg required fields conditionally 6 years 9 months ago #37202

Hi,

I hope that somebody is still reading this post. I don't understand what to put instead of "jQuery( ".class_of_the_username_field" ).hide();"

The field I want to hide is named "Account" but there is no class. So what do I put instead of .class_of_the_username_field?

Thanks and regards,
Uwe
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!