using nuHide to hide a file input object

Questions related to customising nuBuilder Forte with JavaScript or PHP.

using nuHide to hide a file input object

Unread postby nickrth » Fri Jun 04, 2021 9:38 pm

Hi there,

I have a basic bit of javascript that I'm using to hide an object based on a value on the form.
Code: Select all
    var dt   = $('#dish_mealtype_id').val();
    if (!(dt=="2" || dt=="4" || dt=="6" || dt=="7"))
        {
        nuHide('recipe_card');
        nuHide('dish_image_upload');
        }


It hides the recipe_card object card beautifully, but the dish_image_upload is not hidden.

recipe_card object is a button run object
dish_image_upload is a file input object

Any thoughts as to why this might be the case? Or if I'm doing something wrong?

Many thanks in advance for any help you can provide.
nickrth
 
Posts: 19
Joined: Sun Aug 23, 2020 10:49 pm

Re: using nuHide to hide a file input object

Unread postby kev1n » Fri Jun 04, 2021 10:07 pm

Hi,

I'll fix the nuHide() function later. For now, use this JavaScript code:

Code: Select all
function hideFileObject(i) {
  nuHide(i);
  nuHide(i + '_file');
}

hideFileObject('dish_image_upload');
kev1n
nuBuilder Team
 
Posts: 2057
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Re: using nuHide to hide a file input object

Unread postby nickrth » Sat Jun 05, 2021 9:41 am

Hi Kev1n,

That worked perfectly. Thanks so much for your prompt help, really appreciate it.
nickrth
 
Posts: 19
Joined: Sun Aug 23, 2020 10:49 pm


Return to Custom Code

Who is online

Users browsing this forum: No registered users and 8 guests

cron