Jump to content

Recommended Posts

Posted

Hello There fellow PW gurus.

I am trying to make a field show as open only if the field is filled out with at string.
for example: "my_styles.css" and stay hidden if the field is empty.

The field in question is of type "text" if that helps.

And i put in the "show this field only if"
css_filename!=''

because the field name is "css_filename"

But no mather what the field is closed because i have choosen it as "closed" as default.

What am i doing wrong?

i am running PW 3.0.83 Dev.
 

screenshot_show_field_if_part1.png

screenshot_show_field_if_part2.png

Posted
18 minutes ago, Juergen said:

A typical usecase for https://modules.processwire.com/modules/custom-inputfield-dependencies/

screenshot-www.juergen-kern.at-2017-11-13-12-49-50.png.b4212b7d2697c3b65f1b7cc85fdfe197.png

The code inside the textarea field is not testet but I guess it works.

Another possibility would be to add a hook to "Inputfield::render", but with this module you can use it on all inputfields on your site and I think you will probably need something similar in the future.

With the default "show only if" condition you check for a value of another field and not the same field. So the condition depends on a field different than the css_filename field. Fe show css_filename field only if field XY is not empty.

Thank you @Juergen for this answer.
Now i understand what i did wrong.

I did not know that i could not test the field itself that i wanted to change visibility on.
But your answer explains it well.

I Thought i was going crazy there for a minute :)

 

Posted
Just now, Juergen said:

Sorry that was a wrong information - I have corrected it. You have to use another option.

Oh :) thank you again. 

Missed that one :)

Posted

If you want to completely hide the field (not only closed) you have to set the display option to "open" and add the following condition:

screenshot-www.juergen-kern.at-2017-11-13-13-23-33.png.f953556625c36350c78749d71a5ec908.png

  • Like 2
Posted
3 minutes ago, Juergen said:

If you want to completely hide the field (not only closed) you have to set the display option to "open" and add the following condition:

screenshot-www.juergen-kern.at-2017-11-13-13-23-33.png.f953556625c36350c78749d71a5ec908.png

So many options :) so many choices :)

Thank you.

  • Like 1

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
×
×
  • Create New...