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

  • Home
  • SEARCH
  • 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 9010755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:32:52+00:00 2026-06-16T02:32:52+00:00

I am trying to write an if/and statement based on two different drop down

  • 0

I am trying to write an if/and statement based on two different drop down lists. Is it possible to write something with the logic below? The “if &&” statement does not work properly, but will work just fine with a single “if” statement. I understand the is a bit of code, but this is the only way I can show exactly what is happening.

    function doGet(e) {
  var app = UiApp.createApplication();

  var containerSizeList = app.createListBox().setId('containerSizeList').setName('containerSizeList');
  containerSizeList.addItem("20ft Long");
  containerSizeList.addItem("40ft Long");

  var loadingStyleList = app.createListBox().setId('loadingStyleList').setName('loadingStyleList');
  loadingStyleList.addItem("On Pallets");
  loadingStyleList.addItem("Floor Loaded");

    var tenPalletPanel = app.createHorizontalPanel().setId('tenPalletPanel').setVisible(true);
    var tenPalletLabel = app.createLabel('10 Pallets Available').setId('tenPalletLabel');
    var twentyPalletPanel = app.createHorizontalPanel().setId('twentyPalletPanel').setVisible(false);
    var twentyPalletLabel = app.createLabel('20 Pallets Available').setId('twentyPalletLabel');
    var loadingNotePanel = app.createHorizontalPanel().setId('loadingNotePanel').setVisible(false);
    var loadingNoteLabel = app.createLabel('Note: Only certain products may be floor loaded')
    .setId('loadingNoteLabel');

    var containerGrid = app.createGrid(1, 2);
    containerGrid.setWidget(0, 0, containerSizeList);
    containerGrid.setWidget(0, 1, loadingStyleList);

    var handlerJ = app.createServerClickHandler('palletChangeMe'); 
    containerSizeList.addChangeHandler(handlerJ);
    loadingStyleList.addChangeHandler(handlerJ);
    handlerJ.addCallbackElement(containerGrid);       

  app.add(containerGrid);
  app.add(tenPalletPanel);
  tenPalletPanel.add(tenPalletLabel);
  app.add(twentyPalletPanel);
  twentyPalletPanel.add(twentyPalletLabel);
  app.add(loadingNotePanel);
  loadingNotePanel.add(loadingNoteLabel);

  return app;
}

function palletChangeMe(e){
  var app = UiApp.getActiveApplication();

  if (e.parameter.containerSizeList == "40ft Long" && e.parameter.loadingStyleList == "On Pallets"){
    app.getElementById('tenPalletPanel').setVisible(false);
    app.getElementById('twentyPalletPanel').setVisible(true);
    app.getElementById('loadingNotePanel').setVisible(false);
}

  return app;
}
  • 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-06-16T02:32:53+00:00Added an answer on June 16, 2026 at 2:32 am

    Instead of:

    if (e.parameter.containerSizeList == "20ft Long"){
      and if (e.parameter.loadingStyleList == "On Pallets"){
    

    Should be:

    if (e.parameter.containerSizeList == "20ft Long" && e.parameter.loadingStyleList == "On Pallets"){
    

    Note: && means logical AND. Read more about logical operators at MDN.

    and you need to remove last } in each if statement, so final code would be like:

    if (e.parameter.containerSizeList == "20ft Long" && e.parameter.loadingStyleList == "On Pallets"){
        app.getElementById('tenPalletPanel').setVisible(true);
        app.getElementById('twentyPalletPanel').setVisible(false);
    }
    
    if (e.parameter.containerSizeList == "40ft Long" && e.parameter.loadingStyleList == "On Pallets"){
        app.getElementById('tenPalletPanel').setVisible(false);
        app.getElementById('twentyPalletPanel').setVisible(true);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a fairly complex JPQL statement that sorts results based on
I'm trying to write an R script to evaluate different expressions based on fitting
I'm trying to write a SQL Statement that should function like the below Linq
I am trying to write a statement for counting the employees attendance and execute
I'm trying to write an insert statement for a SQL Server table that inserts
I'm having some trouble trying to incorporate a read and write statement into evaluateStatementInner
I'm trying to write a valid mysql statement that would allow me to update
I'm trying to write an IF ELSE statement to enable shipping, If user doesn't
I am trying to write a custom select statement in Hibernate using the getHibernateTemplate()
I am trying to write a javascript function with an if statement that will

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.