• 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

Onclick Event of <li> tag Not Fireing

 
Ranch Hand
Posts: 2211
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to get a combo box list item onclick event to fire js function but nothing is working:

 
Ranch Hand
Posts: 312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do you mean with "nothing is working"? Does the function gets invoked?
 
Steve Dyke
Ranch Hand
Posts: 2211
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Albareto McKenzie wrote:What do you mean with "nothing is working"? Does the function gets invoked?



It was not firing the function at all but I finally figured that the click event was tied to jquery function and I added my function to that call.

But in my call I am using AJAX to set a value in a dropdown tag. The tag is dynamicly populated using jstl with a value and display test. I can get the value to set correctly but how do I get the display to show the associated text.

The dropdown is populated as such:

value 1 Text L-R
value 2 Text L-CTR-R
value 3 Text L-CTRL-CRTR-R

If my AJAX callback sets the value of the drop down to 2 how do I get the tag to display L-CTR-R?
 
Albareto McKenzie
Ranch Hand
Posts: 312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't really understand the problem, you have a list with onclick event in the elements, then you also have a selection box (dropdown) but I still don't get what you want to show where and when.

What is "the tag" in this sentence : "how do I get the tag to display L-CTR-R?"
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looking at serverside markup is no help. Show what the browser receives.
 
Steve Dyke
Ranch Hand
Posts: 2211
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Eric Pascarello wrote:Looking at serverside markup is no help. Show what the browser receives.



My web app is built using div tags and $.load. SO when I do a display of the source code in the browser I only get the index.jsp code no matter where I am at in the application. I am using IE8. How do I get the source code from what ever page I am on?
 
Albareto McKenzie
Ranch Hand
Posts: 312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use Developer Tools (press F12 or go to tools > Developer Tools)
 
Steve Dyke
Ranch Hand
Posts: 2211
2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Steve Dyke wrote:

Albareto McKenzie wrote:What do you mean with "nothing is working"? Does the function gets invoked?



It was not firing the function at all but I finally figured that the click event was tied to jquery function and I added my function to that call.

But in my call I am using AJAX to set a value in a dropdown tag. The tag is dynamicly populated using jstl with a value and display test. I can get the value to set correctly but how do I get the display to show the associated text.

The dropdown is populated as such:

value 1 Text L-R
value 2 Text L-CTR-R
value 3 Text L-CTRL-CRTR-R

If my AJAX callback sets the value of the drop down to 2 how do I get the tag to display L-CTR-R?



I have an input form with four inputs:

A tail number,
line number,
configuration number(drop down, value - display),
Example:
value 1 Text L-R
value 2 Text L-CTR-R
value 3 Text L-CTRL-CRTR-R

starting row number.

When I click submit these values are stored. The configuration is stored as the value.

Now when the user opens the form the bext time they will have a combo box where they can type in new info or select a previous entry by the tail number. When the form populates using AJAX I need the configuration(drop down box) to display L-CTR-R since the value of 2 was stored and then subsequently retrevied by the AJAX call.
 
Albareto McKenzie
Ranch Hand
Posts: 312
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you have to tell the dropdown which option is the selected, with raw Javascript it would be something like this:


Fully untested code, but you get the idea. In jQuery and other libraries there is a build in way to do it.
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Steve Dyke wrote:My web app is built using div tags and $.load.



load means you are using a GET request so load the page! ;)
 
Remember to always leap before you look. But always take the time to smell the tiny ads:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic