TOPIC:

Turn off field(s) 4 weeks 18 hours ago #248629

  • Topic Author
  • paolo.procacciante
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 118
  • Thanks: 0
Hello,
I'd like to know how can I turn off field conditionally if user is specific:
e.g.
$user = JFactory::getUser()->id(1);
if($user)
{
    //remove element <- how to do that?
}

Thank you

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

Turn off field(s) 4 weeks 18 hours ago #248634

  • tihana.krivic's Avatar
  • tihana.krivic
  • Online
  • Moderator
  • Moderator
  • Posts: 1661
  • Karma: 3
  • Thanks: 149
Hi,

for this you can do this:
1) Create a Hidden input field in your form named "userid".
In the Value field in that element's properties put the following code:
<?php $user = JFactory::getUser(); return "$user->id"; ?>

2) Then go to your form->Advanced->Visibility rules and put this for example:
turn off element field1 if userid is 1

Please replace field1 with name of your element (not title), which you want to turn on/off

Let me know if it helps

Regards,
Tihana

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

Last edit: Post by tihana.krivic.

Turn off field(s) 4 weeks 17 hours ago #248640

  • Topic Author
  • paolo.procacciante
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 118
  • Thanks: 0
It is not working
Please check attached images
Additionally how can I target multiple IDs? || is not working


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

Turn off field(s) 4 weeks 17 hours ago #248641

  • tihana.krivic's Avatar
  • tihana.krivic
  • Online
  • Moderator
  • Moderator
  • Posts: 1661
  • Karma: 3
  • Thanks: 149
Hi,

this should works for logged in user's.
For multiple IDs:
turn off element field1 if userid is #somevalue|someothervalue

Regards,
Tihana

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

Turn off field(s) 4 weeks 17 hours ago #248642

  • Topic Author
  • paolo.procacciante
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 118
  • Thanks: 0
of course I'm logged in and my user id is 390 but I can see the element

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

Turn off field(s) 4 weeks 17 hours ago #248645

  • Topic Author
  • paolo.procacciante
  • Offline
  • Senior Breezer
  • Senior Breezer
  • Posts: 118
  • Thanks: 0
I'm also using "form pieces" area for other things, how can I do that from there?

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

  • Page:
  • 1
  • 2
Moderators: ForumSupport
Time to create page: 0.052 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!