I have a inline html field on Suitelet and have bu...
# suitescript
b
I have a inline html field on Suitelet and have button in inline html field. I want to run function in client script and how can I do that in 2.0?
Copy code
inlineField.defaultValue = '<input type="radio" name="testing_radio" value="testing" onclick="testingFunc(this)">Testing'
form.clientScriptModulePath = '/ClientScript.js';
In client script
Copy code
function testingFunc(elm){
}

return {testingFunc:testingFunc, pageInit:_pageInit}
When that input button is clicked it shows me testingFunc is not defined error message
n
Why are you not using the form.addButton() API?
b
not only button but like Radio or checkbox for better UI
native NS layout is very difficult to customize
b
your question is equivalent to asking why does
Copy code
(function () {
  function testingFunc(elm) {}

  return { testingFunc: testingFunc };
})();

testingFunc();
throw the not defined error message
the more accessible version is
Copy code
{
  testingFunc: function testingFunc(elm) {}
}

testingFunc();
though it looks less similar to what was originally written
either way, you need to understand scope better
especially global scope if you are using onclick in that manner
b
Thank you for your information but why it works if use native NS button?
Copy code
form.addButton({
label:'TESTING',
functionName: "testing"
})

form.addField({type:'inlinehtml', ... }).defaultValue = "<button onclick="testing()">TESTING</button>"
I can see in testing function is defined in chrome developer mode? and they are in same scope?
b
take a look on the onclick that netsuite adds
compare it to yours
b
Okay. I really appreciate your help