Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SubString Help

Status
Not open for further replies.

zishan876

Programmer
Mar 19, 2007
61
US
Hi All
Happy Holidays...
I do not know what is wrong with my statement below:
Code:
var rLength= recordIds.length;

var rString = recordIds; 

var startingPos = rString.lastIndexOf("recordIds");


var idName = rString.substring(startingPos+6,rLength);
var myNewString = idName.replace(/,/gi,"','"); 

var strSQL="select Id,  Description__c from Position__c where Id in('" + myNewString+ "')";
I get an error on Substring is not a function????


var idName = rString.substring(startingPos+6,rLength);

Basically user will select more then 2 records form the list view and then click on a custom button to insert records...
I needed to replace between the commas and place in something like this 'XXXrecordid','XXrecordid'
Thanks
 
What is 'recordIds'? Is it a string type? if not, that might be your problem.

Try forcing rString to be a string:

Code:
var rString = '' + recordIds;

// or

var rString = recordIds.toString();

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top