integrating input fields using IME with "Scene" in samsung smart tv? - javascript

Below mentioned code is able to show me keypad but the problem is after pressing any key it gives me "body is not activated....." because of
document.getElementById("userid").focus();
But If I remove document.getElementById("userid").focus(); Keypad will not generate and Keys are started working
Sample Code for IME
SceneSignIn.prototype.handleShow = function (options) {
alert("SceneSignIn.handleShow()");
// this function will be called when the scene manager shows this scene
this.ime_plainText = new IMEShell("userid");
this.ime_passwordText = new IMEShell("password");
document.getElementById("userid").focus();
}

Check if:
You have the default on new javascript application anchor element in index body. This:
Your focus management in the application is not being interfered when you give the input element focus.

Related

Tab order on prompt page

Using Cognos Analtyics 11.1.7IF9.
I have a user who, oddly enough, wants Cognos to make his workflow more efficient. (The nerve!) He thinks that if he can use the TAB button to navigate a prompt page, he'll be faster because he never needs to reach for the mouse.
To test this I created a simple report with a very simple prompt page using only textbox prompts. As I tab I notice it tabs to everything in the browser: browser tabs, the address bar, other objects in Cognos, ...even the labels (text items) I created for the prompts. Oh... and yes, at some point focus lands on a prompt control.
Within Cognos, I see that the tab order generally appears to be from the top down. (I haven't tried multiple columns of prompts in a table yet.) I must tab through the visual elements between the prompts. Also, while value prompts get focus, there is no visible indication of this.
Is there a way to set the tab order for the prompts on a prompt page?
Can I force it to skip the non-prompt elements?
Can the prompts be made to indicate that they have focus?
I tagged this question with javascript because I figure the answer will likely involve a Custom Control or a Page Module.
Of course, then I'll need to figure out how all this will work with cascading prompts and conditional blocks.
I found a similar post complaining about this being a problem in Cognos 8. The answer contains no detail. It just says to go to a non-existent web page.
I had the same frustration as your user and I made a solution a while back that could work for you. It's not the most elegant javascript and I get a weird error in the console but functionally it works so I haven't needed to fix it.
I created a custom control script that does 2 things on a prompt page.
First, it removes the ability to "select" text item elements on the page. If you only have text items and prompts on the page it sets it's "Tabindex" to "-1". This allows you to tab from one prompt field to the next without it selecting invisible elements or text elements between prompts.
Secondly, if you press "Enter" on the keyboard it automatically submits the form. I am pasting the code below which you can save as a .js and call it in a custom control on a prompt page. Set the UI Type to "None"
define( function() {
"use strict";
function AdvancedControl()
{
};
AdvancedControl.prototype.initialize = function( oControlHost, fnDoneInitializing )
{
function enterSubmit (e)
{
if(e.keyCode === 13)
{
try {oControlHost.finish();} catch {}
}
};
function setTab () {
let nL = [...document.querySelectorAll("[specname=textItem]")]
//console.log(nL)
nL.forEach((node) =>{
node.setAttribute('tabindex','-1')
})
};
setTab();
let exec_submit = document.addEventListener("keydown", enterSubmit, false);
try {exec_submit;} catch {}
fnDoneInitializing();
};
return AdvancedControl;
});

How to unlock fields with java script function in CRM 2011

I need to add java script function to CRM 2011 account
that open disable field for editing.
I wrote:
Xrm.Page.getControl(“fieldname”).setDisabled(false);
but it doesn't work, and keep asking me a function.
How should I write it?
I use the following:
var control = Xrm.Page.ui.controls.get("fieldname");
if (control != null)
{
control.setDisabled(false);
}
Here are the steps to add javascript to account entity:
open crm 2011. Click on settings
Click on customizations
Click on customize the system
Click on entities
click on account entity open the tree view
click on forms
click on information form type = main
click on form properties
click on add -> new -> enter name of web resource
select type jscript
In the text editor enter the following code:
function Unlock()
{
var control = Xrm.Page.ui.controls.get("fieldname");
if (control != null)
{
control.setDisabled(false);
}
}
Save and close. Publish the function.
then in event Handlers click add
Select the recently added library and enter function name Unlock without braces
Save and Publish

sharing a button variable between two files

I have a button which when clicked opens up a modal window with additional share functionality. Everything works fine on Android, but I have a small issue with iOS. I am able to share a variable which is just a number, but not the variable which is a button. Code below from main app.js:
var shareBtn2;
var fullScore;
shareBtn2.addEventListener('singletap', function (e){
shareBtn2.setBackgroundImage('share_pressed.png');
var shareModal = require('shareModal');
var shareModalView = new shareModal();
Ti.App.myGlobalVar=shareModalView;
win2.add(shareModalView);
if (DJBool){
Ti.App.fireEvent('shareModalEvent', {
myBtn: shareBtn2,
myPts: Math.round(fullScore)
});
alert('Was a DJBool');
}
and then in my second file which contains 4 buttons to share via, fb, twitter, email and a cancel button.
Ti.App.addEventListener('shareModalEvent', function(event) {
globalPts=event.myPts;
globalBtn=event.myBtn;
alert('received share modal event');
});
console.log(typeof globalPts);//outputs number
console.log(typeof globalBtn);//outputs undefined
The only reason I need this button in my second file is if the user presses the 'cancel button' in the second file, I want to change the backgroundImage of my shareBtn to it's original state. i.e.
cancelBtn.addEventListener("click", function (e){
cancelBtn.setImage('cancelShare_pink.png');
win2.remove(Ti.App.myGlobalVar);
globalBtn.setBackgroundImage('share.png');
});
Hope I have been clear.
Turns out you can't pass round Ti.UI objects in events, only primitives (like strings, numbers) in IOS but it worked on Android. In he end I wrote another custom event to solve the issue

Event change doesn't fire on dynamically populated Picker - Titanium SDK

I'm trying to create a custom Picker whose data is from a remote JSON. The problem is that it doesn't fire the 'change' event on the picker at the first time when I select a row from the picker, I have to close the picker and select a row from the picker again and then the event change works.
var clubs_data = [];
//custom object to handle the httpClient
new K().scoutmobile.Tools.getData(new K().scoutmobile.URL_BASE, {Accion:new K().scoutmobile.CLUBS}, function(_response){
if(response.status.codigo === "RESULT"){
clubs_data.push(Ti.UI.createPickerRow({title:'select a club'}));
for(_j in _response.data){
clubs_data.push(Ti.UI.createPickerRow({color:'#fff',title: _response.data[_j].Propiedades.club_nombre.Valor, id:_response.data[_j].Propiedades.club_id.Valor}));
inputClubs.add(clubs_data); //where inputClubs is created previously
}else{
new K().scoutmobile.Tools.createDialog('invalid_user_alert_dialog_title','invalid_user_alert_dialog_message');
}
});
//event listener
inputClubs.addEventListener('change', function(e){
Ti.API.info(e.row.id);
});
win.add(inputClubs);
In the Titanium Studio Console I get this:
[WARN][InputManagerService( 60)] Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#43f8dbb8
Any ideas what it is happening?
I have three solutions for this, none of them are good enough:
A very stupid solution would be having picker pointing at empty option at start, then user need to change it anyways
If you loading another element of UI using that picker value, you can preload that part with the default (or first) option
You can modify Titanium SDK source code, where they write this log "Window already focused' and fire change event instead. This is pretty simple, I have done that for TabGroup control, it may take 2 hours of your time (either for Android or iOS)

RadScheduler update interval

I'm using RadScheduler for my project. In the scheduler, I need a periodical update, so in my javascript, I set interval for a method that call rebind() on the RadScheduler for every 60 seconds. The problem is that, when my user open the advanced form, the rebind() method makes the form disappear. How can I detect AdvancedForm opening and closing event so that I can stop /restart the timer ?
Thank you in advance.
While there is an event for when the RadScheduler opens its Edit form, called OnClientFormCreated, there is not one for when the edit form closes. There are ways to do this though, but you have do add some additional code.
When you think about it there are several different items that can lead to the form closing - the user can click on the close icon at the top right (or left, depending on your orientation) of the window, they can click cancel, or they can hit save.
Keeping that in mind, we can take a look at this demo, which shows the Advanced Edit Form in action, and also has some JavaScript pre-written for us.
Within the schedulerFormCreated() function we can do the following:
function schedulerFormCreated(scheduler, eventArgs) {
// Create a client-side object only for the advanced templates
var mode = eventArgs.get_mode();
if (mode == Telerik.Web.UI.SchedulerFormMode.AdvancedInsert ||
mode == Telerik.Web.UI.SchedulerFormMode.AdvancedEdit) {
// Initialize the client-side object for the advanced form
var formElement = eventArgs.get_formElement();
var cancelButton = $("[id$='_CancelButton']");
cancelButton.on("click", formClosed);
var templateKey = scheduler.get_id() + "_" + mode;
....
And then we have the formClosed event:
function formClosed(eventArgs) {
}
in formClosed you can just create your logic for resuming the timer, while in schedulerFormCreated you can directly call the function that stops the timer right after that if-statement.
In case you're wondering what we're doing here we're simply grabbing an instance of the jQuery object representing the element with an id that ends with _CancelButton (we're not interested in the beginning part) and then just binding to the click event using the .on() jQuery function.
To get an instance of the save button you just have to use _UpdateButton, and for the close icon it is _AdvancedEditCloseButton. Keep in mind that any element that ends with these substrings will be selected, so if you want to be more specific I recommend inspecting the elements of your advanced form using FireBug or the Chrome Dev tools to get their ID and plug that into the selector above.
This should allow you to get the functionality you're looking for.

Categories