Jump to content

[Solved] Show this field only if - doesn't seem to work


Klenkes
 Share

Recommended Posts

Finally I got some time to check out RockPageBuilder. I have great hopes!

I got 2 fields that depend on the the state of a SELECT as radio buttons called button_linktype:
The selectable options:
1=interne Seite
2=externe Website

Outside of RPB I am able to do Show this field only if button_linktype=1 or button_linktype=2 to show or hide the depending field.
In a RPB block this doesn't work! Neither PW backend nor frontend edit.

I suspect this has something to do with the problem that I also cannot access a select option(->title) in my viewfile of a block:

// 1=blue 2=black
// Outside RPB this works as expected
// Inside RPB this results in the PW Pagetitle instead of blue
$some_var = $block->button_style->title;

Tracy shows that all vars are there. It's a problem of accessing them.

PW 3.0.226 | RPB 4.8.0

Edited by Klenkes
Problem solved
  • Thanks 1
Link to comment
Share on other sites

  • Klenkes changed the title to Show this field only if - doesn't seem to work

Hi Bernhard.

No rush! I have no current project 😟 and just checking the module out.
So far I like it and will use it if a fitting project comes up. Then of course I will purchase the next bigger licence.

  • Thanks 1
Link to comment
Share on other sites

@Klenkes thx, I already found the source of the problem. Repeater fields have to be renamed because we can have many fields "foo" on one page, so they are named "foo_repeater123" and "foo_repeater456" and such. This conflicts with the showif condition, which would still be "foo=something".

I'm wondering though why it does not work on the frontend when using ALFRED. Are you sure? For me it works in two senarios:

1) If I edit one block in a separate window: 
bruZu9t.png

2) In an ALFRED modal opened from the frontend

It does not work on the backend view:

YsCvmAu.png

Because in that last case we have fieldnames with the _repeaterXXX suffix. In the first 2 cases we open only the single page, so we don't have these suffixes.

Can you confirm that it is the same for you?

  • Like 1
Link to comment
Share on other sites

You are absolutely correct.
It works in a separate window and on the frontend with Alfred. The not working frontend I probably imagined...
Okay, I can live with that.

That leaves me with the other problem with selects.
How to access the more speaking title of an option in my blockname.view.php:

// Options: 1=blue 2=black
// Outside RPB this works as expected
// Inside RPB this results in the PW Pagetitle instead of blue
// $block->button_style gives me only the ID
$some_var = $block->button_style->title;

 

Link to comment
Share on other sites

1 hour ago, Klenkes said:

That leaves me with the other problem with selects.
How to access the more speaking title of an option in my blockname.view.php:

I don't understand. It should be the same as with every other page. I just tried with an options field and $block->opt gives me this

4z8HhHr.png

And $block->opt->title gives me "foo"

Link to comment
Share on other sites

That's weird... 
This is $block->button_style:

image.png.bbd78c9e8fdd5d0857b769af939f5871.png

$block->button_style->title returns "Über uns" aka the page title, where it should be: schwarz.
(Same happens to the other Select in the block $button_size)

Is there a dependency for the fieldtype like for textareas?

The underscore in the name? ...grasping at straws...

Link to comment
Share on other sites

22 hours ago, Klenkes said:

That leaves me with the other problem with selects.
How to access the more speaking title of an option in my blockname.view.php:

For everybody else reading: This was actually a small bug in RockFrontend that is fixed now on the dev branch 🙂 

Thx for finding and helping me debug it @Klenkes

Link to comment
Share on other sites

  • Klenkes changed the title to [Solved] Show this field only if - doesn't seem to work

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...