function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
LinThawLinThaw 

How to use "name" Attribute of apex:page?

Hi there,

How to use "name" Attribute of apex:page?
And what is the purpose of using?

User-added image


As describe in here,
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_page.htm

"The unique name that is used to reference the page in the API."

but we can create other page with same name attribute.

User-added image

Is there will be error when reference from api?

Thanks in advance.

Regards,
LinThaw
Best Answer chosen by LinThaw
Bhargavi TunuguntlaBhargavi Tunuguntla
Hi
 The attribute 'Name'  is used to reference from other vf pages which may be related to our present vf page or it is used in java script functions to access the fields in the page. 

For Example let us consider as below,
<b><strong><script type="text/javascript">
function grabExName()
{
var ex = document.getElementByName('pagename:elementname');
alert(ex);
}
</script></strong></b>

 

All Answers

Raj VakatiRaj Vakati
there is no error but aways it is refer from the visualforce page name rather than apx:page name 
LinThawLinThaw
Thanks for reply Raj.

How to use it?
could you please give me some example.

Regards,
LinThaw
Bhargavi TunuguntlaBhargavi Tunuguntla
Hi
 The attribute 'Name'  is used to reference from other vf pages which may be related to our present vf page or it is used in java script functions to access the fields in the page. 

For Example let us consider as below,
<b><strong><script type="text/javascript">
function grabExName()
{
var ex = document.getElementByName('pagename:elementname');
alert(ex);
}
</script></strong></b>

 
This was selected as the best answer