If anyone is using "Ext.Msg.prompt(“Title”, “Pleas...
# suitescript
d
If anyone is using "Ext.Msg.prompt(“Title”, “Please enter your text:”, callback);" to get a NS styled dialog box with a text input, it will work for most records but unfortunately it does not work for the newer native record Inbound Shipments. It errors with Uncaught ReferenceError: Ext is not defined. If someone knows a good workaround that'd be great.
d
I did find this, thanks for the link. I suppose I'll have to invest in a more serious DOM hack like this.
Also I lied: it does error I was just catching it and didn't notice.
m
@netsuite_insights has all the code available for free from that link
d
Yes and I can see in the first example he's using a script tag code injection in a dialog box. I'll use that. Thanks michoel!
@netsuite_insights Unfortunately the script injection didn't work on Inbound Shipments, the code shows up as plain text in the message. This was after importing the whole free module script.
m
@Daniel Lloyd is jQuery loaded on that page? I didn't download the module but from the code shared on the post it looks like it's relying on NetSuite's version which may not be available on that page
d
I can see this: <script type='text/javascript' src='/authentication/ui/jquery/jquery-3.5.1.min.js?NS_VER=2021.1.0&minver=148'></script>
I think it just doesn't support HTML tags in the message.
b
the ui components of the inbound shipment, or honestly any of the newer transactions, are not built on ext js
they wont work the same way
especially if you are trying to do exotic things
d
I'd love to know what it is built on so we can hack that instead, hahaha. But in all seriousness NetSuite please just implement a dialog with an input text box! I mean exotic things might require a hack anyway but a text input isn't too much to ask for? 😐
b
i personally dont recognize it
they might actually be writing their own
the answer i would give is to use your favorite popup library instead
m
Oh yes that reminds me, I have some CSS for swal2 that tries to copy NetSuite UI
Copy code
.swal2-popup {
	padding: 0 0 1em 0;
	border-radius: 0;
	width: 50em;
  }

  .swal2-header {
	padding-top: 1em;
	padding-bottom: 0.75em;
	margin-bottom: 1.5em;
	align-items: start;
	background-color: ${
	  // Try figure out theme color, default to standard blue theme colour
	  document.getElementById("ns_navigation")
		? window.getComputedStyle(document.getElementById("ns_navigation"))["background-color"]
		: "#607799"
	};
  }

  .swal2-title {
	font-size: 14px;
	color: white;
  }

  .swal2-actions {
	align-items: start;
  }

  .swal2-styled.swal2-confirm {
	border: 1px solid #125AB2;
	background-color: #4196FC;
	color: #fff;
	font-size: 14px;
  }
message has been deleted
c
Nice. The Southern Hemisphere has done well overnight :)
n
@Daniel Lloyd I agree with that NetSuite should solve this problem. We shouldn't be needing to hack an input dialog or use third-party libraries. I hope this newui.js they're apparently releasing will feature an input dialog. In the meantime, you could start off with @michoel's tweak and use swal2.