Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
replicant form element name to xpath
RalphFlores
Hi,
Is there a built-in command to convert the replicant form element name ( e.g. "/repTopic[2]/TopicId" ) to its Xpath equivalent ( e.g. "repTopic/1/TopicId" ).
Thanks,
Ralph
Find more posts tagged with
Comments
RalphFlores
Hi,
(sorry need to rephrase it)
Is there a built-in command in FormAPI to convert the replicant form element name ( e.g. "/repTopic[2]/TopicId" ) to its Xpath equivalent ( e.g. "repTopic/1/TopicId" ).
Thanks,
Ralph
JonathonG
I don't believe there is a built-in function for that. But the algorithm would be pretty simple to write. Something like (untested code, may not work exactly as I have it here):
// eleName is the element name
var myRegEx = /\[\d+\]/;
var myNum = elename.Search(myRegEx);
myNum = myNum.slice(1, myNum.length - 1);
myNum = myNum - 1;
var xpath = eleName.Replace(myRegEx, myNum);
Jonathon
Independent Interwoven Contractor
Edited by JonathonG on 04/08/04 10:50 AM (server time).
Sri
Hi,
Can you explain what you are trying to do, the need for such a thing? It'll help me understand the question enough to be able to respond.
Sri
RalphFlores
Thanks Jonathon... I just thought that if there is one, I don't have to write my own function (making codes much cleaner)... Thanks for the reply anyway. I appreciate it.