Keep value in a field even if it is hidden

When hiding a field with a value entered by the user, and then hiding this field through a condition, in the result, it’s as if this value is set to 0! Is it possible to ensure that this value does not default to zero when it’s hidden?

To explain a bit better in my personal case:

I use a calculator to help my company’s salespeople set pricing by entering values for margin, purchase price, etc., which then gives a subscription package in the result.

However, they can’t show the screen to a customer. I would like to add a checkbox that would hide the entered fields, showing only the results, for example.

Currently, if I implement this solution, when I check the box, it successfully hides the fields, but the calculations are recalculated as if these fields were set to 0.

1 Like

Hi @GERARD_HERNANDEZ :wave:

Could you please give me the name of the Calculator widget where you’d like to have this feature?

Hello, its for “Calculateur de Loyer V2”

I’ve set the “New Option” choice field that hide all the “talkingaboutmoney” fields but the consequence is that it also hide the calculation results and make like if the hidden fields are with a value of 0 !

And i need them to keep the entered value… and then work on other conditional logic to hide some results…

1 Like

Hi @GERARD_HERNANDEZ :wave:

Thanks a bunch for the details!

To implement this use case, you should disable a conditional logic to hide the fields when choosing a New option field.

After that:

1, Add this code to the Custom CSS field on the Settings tab of your widget’s settings:

[class*="form__Container-sc"]:has(input#m3fl812t:checked) 
[class*="FormFieldLayout__Container-sc"]:has(.hide-mark){
  display: none;
}

  1. Then choose fields which should be hidden, click on the Code Editor option in the Hint section and paste this element there: <div class="hide-mark"></div>


Try it out and let me know if it helped :slightly_smiling_face:

2 Likes

well… IT WORKS !!! I dit it on the fields… and it works !! So many thanks…!!

Now i’ll try on results.

1 Like

BUT… it doesn’t work on calculations… :cry:
if i try with conditional logic it remove the values…

Do you have a solution like for fields …?

maybe an edit of the css… i see “field” is there somehow a way with calculations …?

i dont know the css language… but you helped me so much i hope you have a quick idea to find out ^^

Could you please clarify which results you want to hide and under what conditions?

i would like to hide :

  • all “chiffre d’affaire” (Total Sales)
  • all “prix d’achat” (Cost Price)
  • all “marge” (Margin)

when the field “Masquer les valeurs” (i just renamed the “New Option” field) is checked.

To explain more simply, this calculator helps my company’s sales team set a subscription price for their proposals. Occasionally, they may show the result to a client.

By ticking the ‘Hide values’ (masquer les valeurs) checkbox, all information regarding profit margin, cost price, and revenue would be hidden, leaving ONLY the subscription installments visible.

1 Like

Okay, I’ll discuss it with the devs and will let you know once I have their response :slightly_smiling_face:

thanks… i’ll wait. thanks again

1 Like

Mmmm… yesterday i’ve tested the <div class="hide-mark"></div> on calculation and it didnt work ! Today i just tested i dont know why ^^ and it seems to work !

2 Likes

Hey there, @GERARD_HERNANDEZ :wave:

Our devs adjusted the CSS code to make it work with the calculations, that’s why everything is fine now:

[class*="form__Container-sc"]:has(input#m3fl812t:checked) 
[class*="FormFieldLayout__Container-sc"]:has(.hide-mark),
[class*="form__Container-sc"]:has(input#m3fl812t:checked) ~ 
[class*="results__Container-sc"]
[class*="result-primary__PrimaryContainer-sc"]:has(.hide-mark),
[class*="form__Container-sc"]:has(input#m3fl812t:checked) ~ 
[class*="results__Container-sc"]
[class*="result-secondary__SecondaryContainer-sc"]:has(.hide-mark) {
  display: none !important;
}

If anything else comes up, we are always here to help :wink: