how can we put a server widget field after another...
# suitescript
a
how can we put a server widget field after another field?
b
a
@battk it seems the only option available is nextField
there is only 1 field in the field group and I want to put the field after that field
s
Ali, try adding a placeholder field (don't show on the form), and then use insertField to insert before that field
a
@Seth Duda Thanks, but any other solution
I don't want to add another field to the form or manipulate the dom
s
You're out of luck
b
use the container parameter
a
@battk Thanks, how can I find the container id?
s
@battk what is the container parameter?
a
I've tested the id from the html element and didn't work
s
I've only seen that function be able to insert a field before another
Sometimes you can use it to insert the last field on the form before your dynamically added field (after first inserting your field)
but I've seen strange behavior doing that
b
container parameter is in the documentation ive linked
otherwise the behavior of adding fields is that it goes last in the container
if there is only one thing in your container, then you dont need to insert in front of it to appear behind it
s
That's a good point, using the addField method might be all you need
no need to move the field using insertField
a
@battk how can I find container id?
it's a custom filed group
b
dom inspecting is usually the way to go
a
so it is not working
b
if its a custom field group, you can take a look at the code that creates it
a
UI custom
@battk is it possible to find the container id from the other field which is already in the container?
c
Are you trying to do this to a suitelet form?
a
no
b
probably not
what id are you getting for your field group
a
from dom inspect
fg_fieldGroup1
@battk I've tested both with and without fg, is it possible that we need to change this id and for example add something to it?
s
Ali, you're adding the field group via script, or was the field group added via form configuration?
a
form config
s
and you're only trying to use addField (with the container param), correct?
a
yes
s
Try fieldGroup_1
a
@Seth Duda no
didn't work and that would be weird really if it did
s
Only reason I wanted to check is because in my account the group ids all have underscores for some reason
I'm out of ideas, sorry!
a
That's ok, thanks.
b
if you cant find an id that works, then you probably need to do dom manipulations
s
Here's something I've used in the past to insert after a field, but I've seen a few cases where this messes up the form itself:
scriptContext.form.insertField({ field : <your custom field obj>, nextfield : '<existing field id on form>' }); scriptContext.form.insertField({ field : scriptContext.form.getField('<existing field id on form>'), nextfield: '<your custom field id>' });