This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes JSP and the fly likes display:column + javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "display:column + javascript" Watch "display:column + javascript" New topic
Author

display:column + javascript

Deeps Mistry
Ranch Hand

Joined: Jan 31, 2009
Posts: 189
Hi,

I Want to pass the "id" attribute to my javascript function.

My jsp:



please help me out.

Thanks
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
URGENT!!! Read this ASAP!

Showing us Serverside markup does not help. Look at the generated html source and paste that here.

I am off to bed, so I can not answer your URGENT query.

Eric

Deeps Mistry
Ranch Hand

Joined: Jan 31, 2009
Posts: 189
Eric Pascarello wrote:URGENT!!! Read this ASAP!

Showing us Serverside markup does not help. Look at the generated html source and paste that here.

I am off to bed, so I can not answer your URGENT query.

Eric


Romit Bose
Ranch Hand

Joined: Oct 03, 2007
Posts: 50
hi,
wouldn't it be nice to pass 'this' from the element to your javascript? instead of passing rowId?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
So I woke up thinking I would see some nice generated code and to my surprise I did not. If you show us some code that is not the serverside markup we will be able to see your problem.

Eric
Deeps Mistry
Ranch Hand

Joined: Jan 31, 2009
Posts: 189
Eric Pascarello wrote:So I woke up thinking I would see some nice generated code and to my surprise I did not. If you show us some code that is not the serverside markup we will be able to see your problem.

Eric



Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
The forum removed the event handlers since the html markup was not in a code tag.

Please check the "Disable HTML in this message" checkbox and repost your code.

Eric
Deeps Mistry
Ranch Hand

Joined: Jan 31, 2009
Posts: 189
Eric Pascarello wrote:The forum removed the event handlers since the html markup was not in a code tag.

Please check the "Disable HTML in this message" checkbox and repost your code.

Eric




Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
And what is $(Emptbl.id)

Eric
Deeps Mistry
Ranch Hand

Joined: Jan 31, 2009
Posts: 189
Eric Pascarello wrote:And what is $(Emptbl.id)

Eric


Emptbl is the table id
id is the property whose value i want to pass to the javascript function.


Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
if Emptbl an html table or an JSON object?

Eric
Deeps Mistry
Ranch Hand

Joined: Jan 31, 2009
Posts: 189
Eric Pascarello wrote:if Emptbl an html table or an JSON object?

Eric


html table
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Shouldn't your code be


or just



Eric
Deeps Mistry
Ranch Hand

Joined: Jan 31, 2009
Posts: 189
Eric Pascarello wrote:Shouldn't your code be


or just



Eric




this is the error i get :

According to TLD or attribute directive in tag file, attribute value does not accept any expressions

I tried both the solutions.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Than that is serverside code, what does

1. "javascript:EmpSelected($('Emptbl').id)"

render when you look at it view the view source of the browser?

Eric
Deeps Mistry
Ranch Hand

Joined: Jan 31, 2009
Posts: 189
Eric Pascarello wrote:Than that is serverside code, what does

1. "javascript:EmpSelected($('Emptbl').id)"

render when you look at it view the view source of the browser?

Eric


the page is displayed with Error. I cant view its source. What do i do?

Thanks
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Um, go back to the way it was before?

I think you were using some sort of JavaScript library there and not serverside code.

I know what the problem is, I am trying to get you to see it be looking at the source code that is generated by your server.

Eric
Deeps Mistry
Ranch Hand

Joined: Jan 31, 2009
Posts: 189
Eric Pascarello wrote:Um, go back to the way it was before?

I think you were using some sort of JavaScript library there and not serverside code.

I know what the problem is, I am trying to get you to see it be looking at the source code that is generated by your server.

Eric

Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
code looks the same

Why is $(Emptbl.id) not being converted to some sort of string?

Eric
Deeps Mistry
Ranch Hand

Joined: Jan 31, 2009
Posts: 189
Eric Pascarello wrote:code looks the same

Why is $(Emptbl.id) not being converted to some sort of string?

Eric


Even I am trying to figure out the same.
I also tried this:
<display:column class="idColumn" property="id" title="Id" sortable="true" href="javascript:EmpSelected('<cut value="*$(EmpTbl.id)*">')" style="width: 70px">
</display:column>

But i am getting syntax error.
Deeps Mistry
Ranch Hand

Joined: Jan 31, 2009
Posts: 189
Deeps Mistry wrote:
Eric Pascarello wrote:code looks the same

Why is $(Emptbl.id) not being converted to some sort of string?

Eric


Even I am trying to figure out the same.
I also tried this:
<display:column class="idColumn" property="id" title="Id" sortable="true" href="javascript:EmpSelected('<cut value="*$(EmpTbl.id)*">')" style="width: 70px">
</display:column>

But i am getting syntax error.


Any idea ranchers? what am i doing wrong?
Himanshu Kansal
Ranch Hand

Joined: Jul 05, 2009
Posts: 257
Is $(EmpTbl.id) correct? Should it be ${EmpTbl.id}? (I ve not followed the complete thread)

Also the javascript call can be with escaped quotes:

or


Regards


Experience and talent are independent of age
Deeps Mistry
Ranch Hand

Joined: Jan 31, 2009
Posts: 189
Himanshu Kansal wrote:Is $(EmpTbl.id) correct? Should it be ${EmpTbl.id}? (I ve not followed the complete thread)

Also the javascript call can be with escaped quotes:

or


Regards


Hey, thanks a lot for your quick rsponse.

I tried


and the corresponding server side code is:



two problems over here:
1) same value for each row i.e in my case "pm am"
2) when i click on the link, the javascript function doesnt get called. I dont get the alert.

Thanks
Himanshu Kansal
Ranch Hand

Joined: Jul 05, 2009
Posts: 257
Hey, good we are reaching somewhere.

I see your link as <a href="javascript:EmpSelected("pm am")">ok fine</a>
should be: or . So tweak it.

Does using $(Emptbl.id) for ${Emptbl.id} iterates over the values?

Regards
Punit Singh
Ranch Hand

Joined: Oct 16, 2008
Posts: 952
Hi,

Did you try this one:



SCJP 6
Himanshu Kansal
Ranch Hand

Joined: Jul 05, 2009
Posts: 257
Punit Singh wrote:Hi,

Did you try this one:



this should do
 
GeeCON Prague 2014
 
subject: display:column + javascript