Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7177567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T16:44:28+00:00 2026-05-28T16:44:28+00:00

I have run into this problem again and now really need to know how

  • 0

I have run into this problem again and now really need to know how to correctly write this array.

I have a drop-box that, based on the value selected, will display a particular field-set(s) via the ID of the field-set.

In some cases, two different values from the drop-box may call the same field-sets. So for example, if I choose banners, several field-sets will be displayed, if I choose Homepage Updates, the same field-sets would be displayed. So I want my array to basically be>> if the value selected in project type drop-box equals Banners or Homepage Updates, show the specified field-sets. The problem is, only the first option works. In this case Banners. When I select Homepage Updates, nothing is displayed.

Does anyone know who to write this array correctly? I have a ton of types that I have to code and the array is the clearest way to write it, but I can’t get past this hurdle. Help please. A portion of the array is below.

var projectTypes = new Array (
  {id : '660' , value:('Banners' ||'Homepage Updates')},
  {id : '659' , value:('Banners' || 'Homepage Updates')},
  {id : '661' , value:'Banners'}, 
  {id : '662' , value:'Banners'},   
  {id : '663' , value:'Banners'}, 
  {id : '668' , value:'Redirect'}, 
  {id : '229' , value:'Affiliates'},
  {id : '236' , value:'Affiliates'},
  {id : '242' , value:'Affiliates'},
  {id : '250' , value:'Affiliates'},
  {id : '251' , value:'Resources'},
  {id : '375' , value:'Resources'},
  {id : '376' , value:'Resources'},
  {id : '377' , value:'Ads'},
  {id : '237' , value:'Ads'}
);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T16:44:30+00:00Added an answer on May 28, 2026 at 4:44 pm

    Firstly, your expression ('Banners' ||'Homepage Updates') will always be evaluated to 'Banners'.
    The logical operator OR ( written as ||) is evaluated as :

    boolean OR boolean
    

    Since the first expression’s argument is a String that is not empty, it is automatically converted to a true value (because of the automatic type-conversion.

    In your case, I suggest You use an array of possible values to for your objects.
    This way, you can choose the appropriate one:

    var projectTypes = new Array (
      {id : '660' , value: ['Banners', 'Homepage Updates']},
      {id : '659' , value: ['Banners', 'Homepage Updates']},
      {id : '661' , values: ['Banners']}, 
      {id : '662' , values: ['Banners']},   
      {id : '663' , values: ['Banners']}, 
      {id : '668' , values: ['Redirect']}, 
      {id : '229' , values: ['Affiliates']},
      {id : '236' , values: ['Affiliates']},
      {id : '242' , values: ['Affiliates']},
      {id : '250' , values: ['Affiliates']},
      {id : '251' , values: ['Resources']},
      {id : '375' , values: ['Resources']},
      {id : '376' , values: ['Resources']},
      {id : '377' , values: ['Ads']},
      {id : '237' , values: ['Ads']}
    );
    

    If I understand correctly and you want to access some ids based on a value, you could organize your objects like this :

    var projectTypes = {
        'Banners' : [660, 659, 661, 662, 663],
        'Homepage Updates' : [660, 659],
        'Redirect' : [668], 
        'Affiliates' : [229, 236, 242, 250],
        'Resources' : [251, 375, 376],
        'Ads' : [237, 377]
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have run into this problem before but never quite solved it. I have
Has anyone run into this problem? I have a collection of comments that I
Has anyone run into this problem... In my layout.phtml I have: <head> <?= $this->headTitle('Control
NOTE: I have solved the majority of this problem but have run into a
Ok so this is a brand new snag I have run into. I am
This is an odd thing I've just run into. I have a web application
I have run into a common, yet difficult problem. I do not use Photoshop
I have run into a bit of a tricky problem in some C++ code,
I have run into a rather weird little problem. In the following code I
I have run into a bit of a problem. Usually when dealing with UITableView

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.