Has anyone try to create a button using inlinehtml...
# suitescript
t
Has anyone try to create a button using inlinehtml in suitelet? can you guide me how... TIA
b
what have you tried?
t
I am trying to create my second button.. I added an inlineHTML field.. but id does'nt appear
b
expect to give enough information for someone else to reproduce the problem
t
function *displayBackButton*(form) {
        
const backButton = form.*addField*({
            
id: 'custpage_utopia_back',
            
type: serverWidget.FieldType.INLINEHTML,
            
label: 'Back'
        
});
        
backButton.defaultValue = '<div class=' + 'container theme-showcase' + 'role=' + 'main' +
                    
'><div class=' + 'jumbotron' + '></div><p> <button type=' + 'button' + ' class=' + 'btn btn-lg btn-primary' + '>Back</button>';
    
}
I'm using this code on the first page of the suitelet.. But every time I display the 2nd page. Back button does not display
b
print the value you are trying to set in the default value
there are a bunch of html syntax errors in it
👀 1
t
hmm technically I wanted to achieve a 2 buttons in my Suitelet.. 1st button uses a addsubmit button and my 2nd button is an inlinehtml
qq though, is it possible to have a 2 submit button on a suitelet?
b
not via addSubmitButton
you need to add your own button via html
t
o alright.. so going back to my problem.. I just wanted to have something like this.. so I use an inlinehtml
Am I on the right path?
b
not with an inlinehtml field
that will basically end up where the rest of the fields are
t
O I see.. even if I use a redirect page...
what should I use to achieve this goal?
b
what is your back button supposed to do
t
it should return on the previous page
I set up a pagrouter, so it counts the current page youre at...
so if I click the Back button, it should subtract pagerouter to 1
b
why arent you using Form.addButton
t
first objective is to create a button that has the same color something like that..
b
dom manipulation it is for you then
t
I dont have any idea on that.. Do you have any reference?
b
its the more traditional use of javascript
t
ok.. thanks you @battk 🙂
b
there are a bunch of ways to add html elements to a a document
👍 1
t
got that.. Atleast I eliminate using the inlinehtml
b
you can use inlinehtml too
its just that you would only use javascript to move the element rather than create it and move it to the correct position
t
yeah.. when I used inlinHtml. It was out of line unlike when I use the addbutton
b
you can also just add a button via serverwidget and change the classname via javascript as well
👍 1
t
ok .. this is what I'm going to do I guess 🙂
b
the way that netsuite's dom is setup means you change the classname of the containing table row rather than the button itself
t
ok noted on this.. classname of the table row.. will check on this 🙂
b
manipulating the html of elements that NetSuite controls puts it at risk of breaking everytime netsuite makes an update
its why dom manipulation are unfavorable
for maintenance reason
t
I see. I think we will consider that part. We dont want Netsuite controls to break just because we want to change the color 😅
s
I wish when you use form.addbutton there where some options of color and not just grey