Untitled.js
# suitescript
r
Untitled.js
This is bizarre... submitting a form to post to a suitelet. I have a checkbox on a sublist, and even when I select mark all, it's coming across as
"F"
when using
request.getSublistValue()
. Thoughts on what's going on here? I must be doing something ridiculous, but I can't figure out what I'm doing wrong.
There was a second sublist, and I have entirely commented that out, so it can't be that i'm confusing sublist Ids. getSublistValue IS returning a value, so I haven't misspelled anything.
The above is happening on POST and I'm not doing anything fancy (except calling
submit()
from the client side - using a custom button instead of the built in submit button).
e
I wonder if it has to do with this:
This method is similar, but not identical to, activating a form's submit <button>. When invoking this method directly, however:
• No submit event is raised. In particular, the form's onsubmit event handler is not run.
• Constraint validation is not triggered.
Especially that first bullet
You could try maybe form.requestSubmit() instead, or I've definitely used jQuery's submit method successfully on custom buttons:
Copy code
const submitForm = (id) => jQuery(id).submit()
// ...
  submitForm('#main_form')
r
requestSubmit()
fixed it. huh
e
Yeah I bet the form's
onsubmit
handler is what collects all the values
r
I guess NetSuite is using the submit event. ya makes sense
e
Sorry, I think I led you down the
submit()
road, but I must have had the jQuery submit method in my head
r
No problem. That is the doc you originally shared, and it did warn me. lol
Copy code
jQuery('#main_form').submit();
that works
Copy code
document.getElementsById('main_form')[0].submit()
that doesn't
Copy code
document.getElementsById('main_form')[0].requestSubmit()
also works
e
That all tracks; doesn't necessarily matter how you select the
<form>
instance, so long as you use
requestSubmit()
(which jQuery must) instead of
submit()
👍 1