• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Select Syntax is Not Producing Desired HTML

 
Ranch Hand
Posts: 2206
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is my java code:

temp = "<select class='${!defaultpramsObj.dashboardflag?'ncrsubarealist':'ncrdashboardsubarealist'}'>" + temp + "</select>";

which is producing this HTML:

<select class="${!defaultpramsObj.dashboardflag?" ncrsubarealist':'ncrdashboardsubarealist'}'="">

I need it to produce:

<select class="${!defaultpramsObj.dashboardflag?'ncrsubarealist':'ncrdashboardsubarealist'}">
 
Steve Dyke
Ranch Hand
Posts: 2206
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Got the HTML to look correct:

${!defaultpramsObj.dashboardflag?'ncrsubarealist':'ncrdashboardsubarealist'}

But the class value is the entire string(Attributes value in development tool):

${!defaultpramsObj.dashboardflag?'ncrsubarealist':'ncrdashboardsubarealist'}

Why isn't it deducing the condition?
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Steve Dyke wrote:This is my java code:

temp = "<select class='${!defaultpramsObj.dashboardflag?'ncrsubarealist':'ncrdashboardsubarealist'}'>" + temp + "</select>";

which is producing this HTML:

<select class="${!defaultpramsObj.dashboardflag?" ncrsubarealist':'ncrdashboardsubarealist'}'="">



I think you're confused about your single and double quotes. Your code appears to create something with a single quote following "class=", but then you say it creates something with a double quote there. If it's really producing something with a single quote there then you might have a problem because the two options of the ternary operator are also separated by single quotes. You might want to try something easier (i.e. with fewer levels of nested quotes) and get that working first.
 
grapes are vegan food pellets. Eat this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic