Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Onclick Event of <li> tag Not Fireing

 
Steve Dyke
Ranch Hand
Posts: 1619
1
  • Mark post as helpful
  • send pies
  • 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:

 
Albareto McKenzie
Ranch Hand
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean with "nothing is working"? Does the function gets invoked?
 
Steve Dyke
Ranch Hand
Posts: 1619
1
  • Mark post as helpful
  • send pies
  • 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: 299
  • Mark post as helpful
  • send pies
  • 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?"
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looking at serverside markup is no help. Show what the browser receives.
 
Steve Dyke
Ranch Hand
Posts: 1619
1
  • Mark post as helpful
  • send pies
  • 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: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use Developer Tools (press F12 or go to tools > Developer Tools)
 
Steve Dyke
Ranch Hand
Posts: 1619
1
  • Mark post as helpful
  • send pies
  • 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: 299
  • Mark post as helpful
  • send pies
  • 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
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • 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! ;)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic