NetSuite / Suitescript - Focus on field on Page Load - cursor

Is there a way through workflow or suitescript to focus to a specific field when the page loads? I don't want a hack.
Thanks!

Unfortunately there is no way to access to the NetSuite UI using SuiteScript because it doesn't support direct access through the DOM. You need to use javascript.

You can use a client script to define the cursor location. In my example I use the field change but you should be able to apply the same logic to the pageinit.
function clientFieldChanged(type, name, linenum){
var nextElement = document.getElementsByName('inpt_custrecord_bathroom1_typeofbathroom');
nextElement[0].focus();
}

Related

Cordova - Angular - <select> tag open a new view

I have an Angular/Cordova app and I'm trying to figure out how should I handle the HTML SELECT tag. What I would like to do is to open a new window with all the options in a list, the user picks one and returns with that value.
The problem is when I do that I lose all the data I had in the first screen as I am closing it when I move to the second one.
I am using Angular's UI.ROUTER. One thing, which I am not too convinced to do, is to save all data entered into StateParams, and when I return, place it back.
What would be the best approach?
It really depends on the use case. If you need to be able to "deep link" to the view where a link loads the view with the pop-up active then using ui-router and stateparams makes the most sense. If deep linking isn't a concern and the user must always select something then you can just use a service/factory/value/provider in order to share the data between the controllers during the lifetime of the app.

How to send events in Adobe Analytics using GTM

I am using GTM to fire Adobe Analytics scripts on all the pages. It is working as desired. However I am wondering if is there a way to set up click events with no page refresh, in the same way as Google Analytics click events are set up. I am using s.tl() call however it is not sending the events to adobe omniture. Any thoughts on this. I know if I use DTM, it can be setup easily.
Assuming that you have Adobe Analytics already present on your website, s object is already present on your website. All you need to do is to put these codes on your website and fire this using GTM as a custom HTML Tag on basis of the trigger you require. There are standard events like gtm.js, gtm.dom and gtm.load already present. You can create your own custom event on top of this on basis of elements load. Using the same event you can fire these lines of codes on your website and this should give you what are you looking for.
<script type = "text/javascript">
var s = s_gi('yourreportsuiteID'); // replace this with your RSID!
s.visitorNamespace = "yournamespace" //optional
s.trackingServer = "yourtrackingserver" //optional
s.trackingServerSecure = "yoursecuretrackingserver"//optional
s.events = "event35";// your event number has to be activated in Adobe
s.linkTrackVars = "events,eVar38";//your eVar number has to be activated in Adobe
s.linkTrackEvents = "event35";
s.eVar38 = {{GTMVariable}}
s.tl( this,
"o",
"FriendlyName" );
</script>
There is nothing specific to Adobe Analytics to consider - GTM has a built-in click event handler. Go to "triggers", "new", select "click" from the options and optionally specify filters (e.g. if you want the trigger to fire only on certain pages, or only when the link has a specific class).
Assign the trigger to a custom HTML tag with your Adobe Code, save, publish and you are all set.

Do we need multiple controllers to implement routes in angularjs?

There is chance that I might not be able to explain my problem properly. Let me try.
I am developing a single page application using angular. This app basically displays the episodes of an online novel series. There is a navigation bar, which has query menus (Like, latest episode, episode of a particular date, episodes with a particular tag, etc). For each of these queries, i want a separate url.
/latest - should display the latest episode
/tag/:tagname - should return all episodes with that tag.
For all these queries, the resultant view is the same (list of episodes). So I will be using the same partial for all routes.
My question is, Should I actually create a new controller for each query? like, LatestEpisodeController, TagController?
Is there anyway I can use the url to determine what the user wants and run that query from within the same controller?
Ofcourse you can use same controller in routing definition, the question is what is the purpose of that? It will be worse to debug it later, if you have a shared functionality it's better to turn it into a factory or service and then use in controllers.
But the answer is YES, you can use same controllers and implement different behaviour basing on i.e. $location.path()
yes you can use single controller for multiple routing..
you can create different functions in controller and in each function do the according job.
In my case I have created different html page for different url and registered same controller for the html pages and in the html page I have called controller method using ng-init in div portion.
You can use same controller and same views as you wish...
$location can help you to get current path or full url if you want and you can call your service depends on your path...
here I write a little example for you to get the idea
PLUNKER

Image crop with AngularJS

I want to let the user crop an image, I found this JQuery plugin - http://deepliquid.com/content/Jcrop.html
I tried to use it with Angular-ui's Jquery passthrough option, adding the ui-jq=Jcrop directive to the <img>
The problem is that If I use ng-src to dynamically change the image it doesn't work and nothing is seen. If I change it to src and put a static url I can see the image and Jcrop.
how can I fix that ?
also, how can I listen to Jcrop's callbacks to know what is the user's selection ?
is there a better / simpler way to add image cropping functionality to AngularJS ?
Here is my solution:
I've written a directive that create img element and apply plugin on it. When src is changed, this img is removed and content that was created by plugin is also destroyed and then re-created new img with new src and again applied plugin on it.
Also provided 'selected' callback to be able to get coordinated that were selected (wrapped in $apply so you can modify your scope values in it).
Check my solution at Plunker
I've built a demo using AngularJS and Jcrop here:
Demo: https://coolaj86.github.com/angular-image-crop
On Github: https://github.com/coolaj86/angular-image-crop
You can leverage ui-event to create an event definition object with the keys being the event names and the values being the callbacks. Or you can simply pass these events as options to Jcrop (according to the documentation)
Finally, there is a new update coming to ui-jq that lets you add ui-refresh which is an expression to be watched to re-trigger the plugin.
Theoretically you should be able to do
<img ui-jq="Jcrop"
ui-options="{onSelect:myCallback}"
ui-event="{onChange:'myCallback($event)'}"
ui-refresh="imgSrc"
ng-src="imgSrc" />
Note: this simply re-fires the passthrough again, and doesn't automatically mean this will fix the problem or that the plugin will behave properly when re-initialized
We're still working on a good way to allow you to trigger different events at different times.

Episerver nested master page from EPiServerUI.master

I want to have my custom master page for all GuiPlugIn reports. As we know, by default GuiPlugIn referes to EPiServerUI.master page which is part of installation. I want to create a nested master page for my GuiPlugIn instead of default.
Please share your thoughts.
Thanks,
Kris
I think the reason that you cannot change master page for a plugin is for visual consistency. You could try to change the master page through code like this (assuming your plug in is a user control:
protected override void OnInit(EventArgs e)
{
this.Page.MasterPageFile = "~/NewMaster.master";
}
Maybe there is a better way to do what you want, if you provide more detail?
You can always access the Page object if you want to inject custom css or scripts to use with your plugin like this:
HtmlGenericControl js = new HtmlGenericControl("script");
js.Attributes["type"] = "text/javascript";
js.Attributes["src"] = "mylibrary.js";
this.Page.Header.Controls.Add(js);

Resources