Page 1 of 1

using nuHide to hide a file input object

Posted: Fri Jun 04, 2021 2:08 pm
by nickrth
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.

Re: using nuHide to hide a file input object

Posted: Fri Jun 04, 2021 2:37 pm
by kev1n
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');

Re: using nuHide to hide a file input object

Posted: Sat Jun 05, 2021 2:11 am
by nickrth
Hi Kev1n,

That worked perfectly. Thanks so much for your prompt help, really appreciate it.