SF_show_inputs vs 'empty' bold table input cells

Hi,

I’m trying to create a table with multiple input cells, some of which are bold. When the template is signed off as completed by the user (via a boolean), the input cells will then lock down using {% assign sf_show_inputs = false %}. When this is showing as false, there appears to be a formatting issue on my ‘empty’ bold input cells within the table: rather than just showing as a blank field, they are instead showing as two italic asterisks.

To replicate this issue, if you take the following code:
{% stripnewlines %} {% t "Disable input field:" %} {% input custom.some.thing as:boolean %} {% if custom.some.thing == "true" %} {% assign sf_show_inputs = false %} {% endif %} {% newline %}{% newline %} |-100%-+ {% newline %} |**{%input custom.some.thing2 placeholder:"Bold text" %}** {% endstripnewlines %}

You will see that the input field is bold; however when ticking the boolean to disable the input field whilst it is still empty, it will show the result **. This only seems to be happening when the input field is part of a table.

Is there a way to get this to just show as blank?

Many thanks
Joe

Hi @jhanley,

In order to display the empty cell as blank, you should include an if-statement around the ** signs to check whether the input is empty (i.e. if custom.some.thing2 != blank). In case the input is not empty, the ** should be placed around the input field.

Please find your amended code hereafter:

{% stripnewlines %} {% t "Disable input field:" %} {% input custom.some.thing as:boolean %} {% if custom.some.thing == "true" %} {% assign sf_show_inputs = false %} {% endif %} {% newline %}{% newline %} |-100%-+ {% newline %} |{% if custom.some.thing2 != blank %}**{% endif %}{%input custom.some.thing2 placeholder:"Bold text" %}{% if custom.some.thing2 != blank %}**{% endif %} {% endstripnewlines %}

Hope this is clear for you!

Good luck finishing your template!

Kind regards,
Robin

Morning @robindeclercq,

Thanks for your response. I understand what you mean and can see how this should be working, though unfortunately it seems that when I now input text into this cell, the asterisks surround the text as though they are also characters (as oppose to altering the formatting):

image

Is there something else that I’m missing? Essentially I’m looking for a one-size fits all approach to the cells, so that all cells will be in bold if they have data and blank if they do not!

Many thanks
Joe

Hi @jhanley,

You have to make sure there is no space between the asterisks and the input field in your code.

**{% input custom.some.thing %}**

Also when using the if-statement, make sure that in the code the if-statement is next to the input field as well in front as after without white space. Furthermore, you need to make sure there is no white space in the cell in general. So between two pipes (|) when using ** there can be no white space or this will result in your screenshot above.

The code I pasted in my earlier reply should work fine.

Unfortunately it will not be possible to have a one-size fit approach for all the cells, you will have to include this if statement around every ** in your code.

Hope this answers your question!

Kind regards,
Robin

That makes perfect sense - all is good now! Thanks as always, @robindeclercq! :smile: My issue was that I separated the code out onto three lines when they should have remained together.

One final issue that I have only just noticed: when using sf_show_inputs = false, any input [x] as:collection fields will disappear. I appreciate I can just embed this with a sf_show_inputs = true then sf_show_inputs = false to keep them active, but is there actually a way to lockdown the collection inputs so that the user may continue to view any attachments, whilst not being able to add, delete or edit them?

I hope that makes sense!

Many thanks
Joe

Glad I could help @jhanley :slight_smile:

In principle separating the code in different lines should have no impact especially when you use the stripnewlines tag. For example, the code we discussed earlier should also work when coded like this:

{% stripnewlines %}
{% t "Disable input field:" %}{% input custom.some.thing as:boolean %}
{% if custom.some.thing == "true" %}{% assign sf_show_inputs = false %}{% endif %}{% newline %}{% newline %}
|-100%-+ {% newline %}
|{% if custom.some.thing2 != blank %}**{% endif %}{%input custom.some.thing2 placeholder:"Bold text" %}{% if custom.some.thing2 != blank %}**{% endif %}
{% endstripnewlines %}

Regarding the sf_show_inputs - indeed, you should embed the part of the code that should not be hidden with a sf_show_inputs = false then sf_show_inputs = true.

Regarding your question on the collection, we assume you mean file_collection?

These can indeed be shown even when sf_show_inputs is false. See the code below:

{% input custom.stuff.things as:file_collection %}
{{ custom.stuff.things.document }}

However, when using the .document filter, only the last added file of your file_collection will show. I will communicate this internally and inform you on how the entire collection can be shown as soon as we know the solution for this.

Kind regards,
Robin

Hi @jhanley,

Following the above, please be informed that you can show the added files in the file collection through following code:

{% input custom.stuff.things as:file_collection %}

{% for document in custom.stuff.things.documents %}
{{ document }}
{% endfor %}

Kind regards,
Robin

Hi @robindeclercq,

Thanks for getting back to me on the above points. I’m not sure if I am still missing something, as this seems to pull through the name of the attachment as oppose to the document itself?

Is there a way to have it so that the attachment can be accessed when sf_show_inputs is false?

Many thanks
Joe

Hello there @jhanley,

you can actually:

{% input custom.check.show as:boolean %}
{% if custom.check.show == true %}
  {% assign sf_show_inputs = false %}
{% endif %}

{% input custom.some.thing as:text %}

{% if custom.attachements.things.document != blank %}
  {% assign sf_show_inputs = true %}
{% endif %}

{% input custom.attachements.things as:file_collection %} 

So we’ll assign the sf_show_inputs to false when there’s a certain check marked. Nothing special there.

Later in our code, we’ll do this:

{% if custom.attachements.things.document != blank %}
  {% assign sf_show_inputs = true %}
{% endif %}

What this does, is check the database variable custom.attachements.things and see if it has something of one or more documents in it (that’s what the attribute .document is for!)
More info here:

When there are attachments added, we will assign that variable sf_show_inputs back to true again so you can see the added files:
58

Closing this topic to avoid becoming overfloaded with different questions to the original post, if you don’t mind :slightly_smiling_face:

1 Like