Anyone know a way to show/ hide an inline html fie...
# suitescript
n
Anyone know a way to show/ hide an inline html field in SS2.0 client script? In SS1.0 you can use nlapiSetFieldVisibility there doesn't seem to be an equivalent and using currentRecord.getField() returns null.
s
I didnt think inline HTML fields are ever shown
n
They are shown if they have content...
s
You can prob just hide them with dom manipulation? Inspect to get the id of whatever div you put in there, and
hide()
it?
n
Oh heck yeah, sure, but you know, "dom manipulation" to get around something you could do in ss1.0, ugh. 😞 (incidentally you can use the ss1.0 nlapiSetFieldVisibility in your 2.0 but that also feels a bit "hacky") @Sandii thanks for replying btw 🙂
s
Yeah i mean it is an inline html field already, so I wouldnt consider it hacky. If you are specifically telling something to display via inline html, then you need to kinda modify whats in that inline html to get it to hide.
f
Hello, You can create a User Event and use the beforeLoad function to set that. Yo will need to use something like context.form.getField passing the expected parameters (see in the netsuite help by Form.getField(options)). After to use the commented function try field.updateDisplayType({displayType: serverWidget.FieldDisplayType.HIDDEN})(getting from the module N/ui/serverWidget). Hope that this works. Regards!
n
@Fran Thanks for the reply but this needs to be via client script, UE is not going to work on a form based SuietLet
e
@NElliott how are you adding that inline html field? If you are adding this via a suitelet, you for sure can use the
field.updateDisplayType
, you could also try to add a CSS class
display:none
in your HTML content
n
the field is added via a UE script but needs manipulating via a client script.
context.currentRecord.getField({fieldId: 'myfield'}); other fields are fine inlineHTML no dice.
r
how about creating a record where the field is then using getField?
287 Views