[Skip to main content](#vessel-content)

#   Option-dependent text field

##

- **[LehmannVisual](/forum/user/59292-lehmannvisual "View LehmannVisual's Profile")**
- [![LehmannVisual's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/59292-lehmannvisual "View LehmannVisual's Profile") Topic Author
- [ Offline](/forum/user/59292-lehmannvisual)

Less More

- Posts: 8
- Thank you received: 1
-
-

1 year 4 months ago [\#367694](#367694) by [LehmannVisual](/forum/user/59292-lehmannvisual "View LehmannVisual's Profile")  *[Option-dependent text field](/forum/30-integrations/909537-option-dependent-text-field#367694 "-- HikaShop version -- : 6.0.0 -- Joomla version -- : 5.3.1 -- PHP version -- : 8.4.7 -- Browser(s) name and version -- : Safari 18.5 -- Error-message(debug-mod must be tuned on) -- : No error message  Is it possible to enable the &quot;Text&quot; text field only if the &quot;Greeting Text&quot; option is set to &quot;Ja&quot; (yes)? With the default setting of &quot;Nein&quot; (no), it should not be possible to enter text.")* was created by *[LehmannVisual](/forum/user/59292-lehmannvisual "View LehmannVisual's Profile")*

-- HikaShop version -- : 6.0.0
-- Joomla version -- : 5.3.1
-- PHP version -- : 8.4.7
-- Browser(s) name and version -- : Safari 18.5
-- Error-message(debug-mod must be tuned on) -- : No error message

Is it possible to enable the "Text" text field only if the "Greeting Text" option is set to "Ja" (yes)? With the default setting of "Nein" (no), it should not be possible to enter text.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMwLWludGVncmF0aW9ucy85MDk1Mzctb3B0aW9uLWRlcGVuZGVudC10ZXh0LWZpZWxkP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86556
- Thank you received: 14305
-
-

1 year 4 months ago [\#367695](#367695) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Option-dependent text field](/forum/30-integrations/909537-option-dependent-text-field#367695 "-- HikaShop version -- : 6.0.0 -- Joomla version -- : 5.3.1 -- PHP version -- : 8.4.7 -- Browser(s) name and version -- : Safari 18.5 -- Error-message(debug-mod must be tuned on) -- : No error message  Is it possible to enable the &quot;Text&quot; text field only if the &quot;Greeting Text&quot; option is set to &quot;Ja&quot; (yes)? With the default setting of &quot;Nein&quot; (no), it should not be possible to enter text.")*

Hi,

There are two ways to do it:

- The hard way is to add a bit of custom javascript to listen to the dropdown selection being changed and then hide / display the input field. This requires a bit of development. Here is a starting point:
[ www.hikashop.com/support/forum/product-c...culation.html#344613](https://www.hikashop.com/support/forum/product-category-display/904986-option-price-calculation.html#344613)
Note however that if the customer enters something in the custom item field and then select "no" in the dropdown and the custom item field is hidden on the page, it will still be taken into account by HikaShop and displayed in the cart / order / invoice. So you would have to also empty the field when "no" is selected.
Another limitation of this solution is that you can make the custom item field required. Because if you do, the system won't let you proceed when "no" is selected.
While it has constraints and is not so easy to do, it is possible to cobble something together with that solution.

- Instead of an option for the extra fee, I would recommend having another custom field of the table "item" and of the type "single dropdown". That way, in the text custom field, you can use the "display limited to" setting to have the system automatically hide / display the text field based on the selection in the dropdown. The "required" mechanism also take into account that "display limited to" setting.
In the past, the limitation of this solution was that you couldn't change the price of the product based on what was selected / entered in the custom item fields. However, a few years back we released the "price calculations" plugin :
[ www.hikashop.com/support/forum/product-c...culation.html#344613](https://www.hikashop.com/support/forum/product-category-display/904986-option-price-calculation.html#344613)
With it, you can use a formula to modify the price with the calculation of a formula with tags. In your case, you could have the value "0.0" for the "no" choice, and the value "15" for the "yes" choice of your dropdown. And then, you could use the formula:
{price}+{xxx}
where xxx would be the column name of the custom field for the yes / no choice.

In fact, you could even do without the yes / no custom field, and just have the text field. Then, you would use the formula:
{price}+15
with the condition
strlen({yyy}) &gt; 0
where yyy would be the column name of the text custom field.
That way, the system would automatically add the 15€ extra fee to the total amount once the user enters something in the text field.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMwLWludGVncmF0aW9ucy85MDk1Mzctb3B0aW9uLWRlcGVuZGVudC10ZXh0LWZpZWxkP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.042 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
