8 years ago
Topic

Hello there,

I have a content type base on article object with a big site form.

I want to use this form partially to unregistered users hidding some fields in joomla menu options (overriding).

My  problem:

Some of the hidden fields of this form are required to registered users, so even if they are hidden to unregistered users the submission

won´t happen because of required setting. 

I tried to use conditionals to disable these fields, but when the form in rendered all off them appears for a moment, and disappear just after. 

My quastion:

Is there any other way to achieve It?

Thanks in advance

Get a VIP membership
4229 Posts
Kadministrator
8 years ago
0
Level 1

If you make a field hidden it still exists on the form. You need to use Access level settings or Restriciton plugins to hide fields from some group.

8 years ago
0
Level 1

Thank you Klas.

I had to go to another way, since I have fields that are required to registered users and not required to guest users at the same time. I will let my solution using

seblod code pack if someone else need it too:

1) Add a javascript field to your form with this code to remove the class "required":

jQuery(function($){
$( "#my_field_id" ).removeClass( "validate[require[required_my_field_name]]" )
});<br>

2) Add a BeforeRender field to your form with this code to remove the "*" from the label of required field:

$fields['my_field_name']->required="";<br>

Of course you can put a conditional based in another field value in both steps to decide when the required class should be removed.

Hope It helps someone!

Get a VIP membership