Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Assigned Value is Changing  RSS feed

 
Steve Dyke
Ranch Hand
Posts: 1759
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the following JSTL code the value I set in the c:set value changes to just MFGPlanning or Supervisors when sent by the input tag onclick. I need the correct string sent to function.

 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is highly unlikely.

Without knowing what the rendered HTML looks like and/or seeing the function you're calling, tough to help. But I suspect those two clues will be enough for you to fix it.
 
Steve Dyke
Ranch Hand
Posts: 1759
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:That is highly unlikely.

Without knowing what the rendered HTML looks like and/or seeing the function you're calling, tough to help. But I suspect those two clues will be enough for you to fix it.


Here is the rendered HTML code:



Here is the function I am calling:



wGroup is MFGPlanners for first call and Supervisors for second call. Need it ('Planning','MFGPlanners') and ('Supervisors').
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And what will ('hello', 'there') evaluate as in JavaScript?
 
Steve Dyke
Ranch Hand
Posts: 1759
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:And what will ('hello', 'there') evaluate as in JavaScript?




Returns ('hello','there')
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's a string, which isn't what your JSP is doing.
 
Steve Dyke
Ranch Hand
Posts: 1759
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:That's a string, which isn't what your JSP is doing.


So how can I get my JSP to push a string to the function?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Put quotes around it.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
*If* that's what you really want to do. Looks more like an array of strings to me.
 
Steve Dyke
Ranch Hand
Posts: 1759
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:Put quotes around it.


I tried the quotes first but everything I try causes a JS error.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you nest quoted things like that you're asking for trouble anyway--is there an actual reason you can't use an array?

In any case--you need to figure out the string quoting stuff. Looking at the rendered HTML is enough to solve this problem.
 
Steve Dyke
Ranch Hand
Posts: 1759
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:When you nest quoted things like that you're asking for trouble anyway--is there an actual reason you can't use an array?

In any case--you need to figure out the string quoting stuff. Looking at the rendered HTML is enough to solve this problem.


I realize that the quoted strings are trouble but I really need this work with them.

I wish it was as obvious to me as it is you on how to fix this.

I I put double quotes around the ${grouplist} I get an error because the onclick method is surrounded by double quotes. If I use single quotes around it I get an error because the string uses single quotes. I have ran out of things to try. Can you give me other hint as to the solution?
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try hand-coding it once (which you could just do anyway, since you're just setting a variable then using it in the next line--not sure what your intent actually is).
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!