71 Posts
Dgikar
9 years ago
7
Topic

Hi All!

How use Conditional States & Trigers in Custom Templates (Seb - Minima)?

Thank you advance for your answer

Get a VIP membership
97 Posts
Anjo
9 years ago
1
Level 1

Hi Dgikar,

Check these manuals and video

http://www.seblod.com/resources/manuals - Advanced section

http://www.seblod.com/resources/videos/playing-with-conditional-states-triggers

Anjo

71 Posts
Dgikar
9 years ago
0
Level 2

Hi Anjo. Thenx for your unswer.

Sorry for my English

But, I know that. I don't know: where and what I must write in Custom Templates (whit Overriding a Position) for Conditional States & Trigers must work

97 Posts
Anjo
9 years ago
2
Level 1

Hi Dgikar,

As far as I know you don't need to write anything other than assigning your fields to the template. Whatever you setup in the backend as a conditional state should automatically work in the frontend. Can you give me an example of what you are trying to do and I'll try to help?

Thanks

Anjo

71 Posts
Dgikar
9 years ago
1
Level 2

Hi Anjo. Thenx for your unswer.

I have these code:

<div class="uk-form uk-form-horizontal j4a=reg-form">
	<div class="uk-text-center uk-form-row j4a-user-reg-select">
		<h3 class="uk-text-center j4a-user-reg-select-label"><?php echo JText::_( 'COM_CCK_DESCRIPTION_REG' );?></h3>
		<?php echo $cck->getForm( 'user_type_registration' ); ?>
	</div>
	<?php echo $cck->getForm( 'reg_to_user_groups' );?>
</div>


<div class="uk-form uk-form-horizontal">
	<?php echo $cck->getForm( 'txt_welcome' );?>
</div>


<div class="uk-form uk-form-horizontal">
	<div class="uk-grid j4a-reg-text-fields">
        <div class="uk-width-1-2"><?php echo $cck->getForm( 'user_username' ); ?></div>
        <div class="uk-width-1-2"><?php echo $cck->getForm( 'user_name' ); ?></div>
        <div class="uk-width-1-2"><?php echo $cck->getForm( 'last_name' ); ?></div>
        <div class="uk-width-1-2"><?php echo $cck->getForm( 'employer_name' ); ?></div>
        <div class="uk-width-1-2"><?php echo $cck->getForm( 'user_password' ); ?></div>
        <div class="uk-width-1-2"><?php echo $cck->getForm( 'user_password2' ); ?></div>
        <div class="uk-width-1-2"><?php echo $cck->getForm( 'user_email' ); ?></div>
        <div class="uk-width-1-2"><?php echo $cck->getForm( 'j4a_country' ); ?></div>
        <div class="uk-width-1-2"><?php echo $cck->getForm( 'region' ); ?></div>
        <div class="uk-width-1-2"><?php echo $cck->getForm( 'city' ); ?></div>
        <div class="uk-width-1-2"><?php echo $cck->getForm( 'user_address1' ); ?></div>
        <div class="uk-width-1-2"><?php echo $cck->getForm( 'div_start' ); ?></div>
        <div class="uk-width-1-2"><?php echo $cck->getForm( 'button_save_close' ); ?></div>
        <div class="uk-width-1-2"><?php echo $cck->getForm( 'button_cancel' ); ?></div>
        <div class="uk-width-1-2"><?php echo $cck->getForm( 'div_end' ); ?></div>
    </div>
</div><br>

Field "user_type_registration" it's - Radio Field and have cuple options and Custom Attributes:

Field "reg_to_user_groups" - Text Field. In number 5, I enter these:

I See these lesson: Playing with Conditional States & Triggers

+ I enter for the test these (In number 5) - Field "user_name":

When (on fron view), I click on first options (JOB_SEEKER=2) in Radio field "user_type_registration", I'm waiting for:

  1. into field "reg_to_user_groups", I see number 2;
  2. field "user_name", stay visible on the site.

When (on front view), I click on second options (EMPLOYER=10) in Radio field "user_type_registration", I'm waiting for:

  1. into field "reg_to_user_groups", I see number 10;
  2. field "user_name", hide on the site.

BUT! When I click on field "user_type_registration" (for any options), nothing happens...

I heard that I can write this code:

	$myFields = $cck->getFields('mainbody');
		if (!empty($myFields)) {
			foreach ($myFields as $myField) {
				$myField=$cck->get('myFieldName');
				if ($myField->conditional) {
					$this->setConditionalStates($myField);
				};
			};
		};

P. S.

When I disable the custom template, Conditional States - work

----------------------------------------------------------------------------------------------------------------

P. P. S.

I think I understand what the problem is ... I using getForm instead renderField because I, in this form, the output label - no need to... Most likely, because getForm Conditional States - NOT work... 

97 Posts
Anjo
9 years ago
0
Level 3

I came across a post in V2 forum

In our next major release you'll be able to use:

$cck->setConditionalStates( $field )

from your custom markup.

http://www.seblod.com/v2/forum/105-General-Discussions/41808-Conditional-States--Trigers-in-Custom-Templates-NOT-WORK.html


97 Posts
Anjo
9 years ago
1
Level 1

Hi Dgikar,

I think you might be right with your last comment about getForm. I've never used that approach as I tend to stick with renderField() which takes into account all internal Seblod core properties. 


 


1283 Posts
Bucklash
9 years ago
0
Level 2

subscribed

Get a VIP membership