Hello,
We are trying to use a SuiteScript with an online support form and haven't been able to resolve one of the issues we are having. When a customer goes to the online support form from being logged into our service, we automatically fill some of the details needed on the form (such as first name, last name, email, and company) with parameters passed through the URL.
Our issue has been that the form always gives us a javascript error in all the browsers we use (in FireFox 2, we get a "_funcname is not defined" error). I am assuming it has to do with using a DOM call in the javascript, but I don't know for sure. I would like to know:
1.) Is there any other way (using NetSuite's SuiteScript commands) to get the URL so we can parse the parameters?
2.) Are we in fact allowed to use the location.search.... command? It fills the form correctly, but we have at times had errors with submissions made through the form and thought it could be related to the javascript error. Is this what is causing the errors to occur?
Any help is appreciated. Thanks.
function StuffForm() { var ary = location.search.split('&'); var f = ary[3].split('='); var email = f[1]; email = email.replace(/+/g,' '); var f = ary[4].split('='); var lastname = f[1]; lastname = lastname.replace(/+/g,' '); var f = ary[5].split('='); var firstname = f[1]; firstname = firstname.replace(/+/g,' '); var f = ary[6].split('='); var coname = f[1]; coname = coname.replace(/+/g,' '); nlapiSetFieldValue('firstname', firstname); nlapiSetFieldValue('lastname', lastname); nlapiSetFieldValue('email', email); nlapiSetFieldValue('companyname', coname); }