Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Nov 2011
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Passing parameters

    Code:
    function viewDetails(rowid,linkid){
    	
    	
    	alert("enterining into bundles");
    	if(linkid=='seobundles')
    	{
    	alert("enetering into if ");
    	document.chwAnnouncementW.action='${contextPath}'+"/dolphin.wss/viewSeobundleW?rowindex="+rowid;
        		document.chwAnnouncementW.submit();
    		
    		
    		
    		
    		
    	
    	}
    
    	else
    	{
    
    	alert(linkid);	
    	document.chwAnnouncementW.action='${contextPath}'+"/dolphin.wss/viewSeoW?rowindex="+rowid;
        		document.chwAnnouncementW.submit();
    	}
    	
    	
    }
    Actually i am passing linkid="seobundles" as string but its not interpreting and it is always going to else part and not if part. I tried to print link id its teling its of object HTML table type and we are passing the two parameters rowid, linkid from a macro. rowid is working fine as and when we select radio buttion but linkid is not working as an string. IF i pur linkid in single quotes then also its not working

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,602
    Thanks
    78
    Thanked 4,387 Times in 4,352 Posts
    If the alert(linkid) says it is an object, then the problem is that you are *NOT* passing an ID. You are passing the actual object.

    So:
    Code:
    function viewDetails(rowid,link){
    	
    	var linkid = link.id;
            alert("linkid is " + linkid);
    
    	if(linkid=='seobundles')
    	{
                   ... etc. ...
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •