+ Start a Discussion
ANKITAANKITA 

Reg: passing Id

<script>

function x(id)

{

-------

}

</script>

<apex:pageblocktable ---------- var="x">

  <apex:commandlink value="{!x.name}" onclick="x({!x.Id})"/>

</apex:pageblocktable>

It is not working.

How can i pass record id from page block section to javascript function.

please suggest me!

 

Thanks

ANKITA

Best Answer chosen by Admin (Salesforce Developers) 
Ankit AroraAnkit Arora

Try this :

 

<script>
    function x(Id)
    {
        alert(Id) ;
    }
</script>
    <apex:pageBlock >
        <apex:commandLink value="{!x.name}" onclick="return x('{!x.Id}');"/>
    </apex:pageBlock>

 It will work for you :)

 

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

All Answers

Ankit AroraAnkit Arora

Try this :

 

<script>
    function x(Id)
    {
        alert(Id) ;
    }
</script>
    <apex:pageBlock >
        <apex:commandLink value="{!x.name}" onclick="return x('{!x.Id}');"/>
    </apex:pageBlock>

 It will work for you :)

 

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

This was selected as the best answer
ANKITAANKITA

Thanks Ankit.

My mistake is,

I used Id instead of id.

 

 

Regards:

ANKITA

 

 

 

Ankit AroraAnkit Arora

That's why I hate javascript ;)

 

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page