dojo not found from popmenu - xpages

I am getting an error:
Script interpreter error, line=3, col=28: [ReferenceError] 'dojo' not found
1: viewScope.ppChoice=context.getSubmittedValue();
2: dBar.info("I am here");
3: var fileUploadPanel = dojo.byId("#{id:fileUploadPanel}");
4: var fileUpload1 = dojo.byId("#{id:fileUpload1}");
5: var butImport = dojo.byId("#{id:butImport}");
6: dojo.style(fileUploadPanel, "display", "block");
7: dojo.window.scrollIntoView(butImport);
8: fileUpload1.focus();
on a onItemClick event of an extension library popup menu. This same code run just fine in a normal button event. I do plan to not use the popupmenu now but I am still curious as to why I get this error from the onItemClick event. Any ideas?

The onItemClick event of xe:dropDownButton expects server-side JS. You are mixing SSJS with dojo which is client-side JS.

Related

Pressing Enter on GTK Entry to activate a button

I have a GTK Entry called task_input. When the user types something and presses enter, it should "click" start_button. I have tried using connect_activate, which works, but it leaves me with the following error:
Gtk-WARNING **: 01:04:12.779: GtkText - did not receive a focus-out event.
If you handle this event, you must return
GDK_EVENT_PROPAGATE so the default handler
gets the event as well
Here is the code:
fn setup_settings(&self) {
let imp = imp::MyWindow::from_instance(self);
imp.task_input.connect_activate(clone!(#strong imp.start_button as start => move |_| {
start.emit_clicked();
}));
}
I believe there is also another way to do this by using imp.task_input.set_activates_default(true); but I have not been able to figure out how to get that to work.
What is the best way to activate a button by pressing Enter from an Entry widget?

unable to locate web element selenium

Hello I am a newbie with Selenium, I am trying to automate a scenario using webdriver framework: find a web element by its id. At the last step of the scenario, I am not able to locate a radio button and my code throws this error Timeout Error
This is my selenium code:
setTimeout(function(){
driver.wait(until.elementLocated(By.id('radRadioSub')), 24000, 'radRadioSub not located');
if (pattern.comment.length > 0) {
driver.findElement(By.name('remarksArea')).sendKeys(pattern.comment);
console.log("Trying to update remarks area")
}
// Select Discard radio >> radRadioDis
console.log("Trying to click on disegard/aprove")
driver.findElement(By.id(actionToDo)).click().then(function()
{
console.log('We clicked on the element' + actionToDo);
});
// Send : >> btnSolveTaskToolbar
driver.findElement(By.id('btnSolveTaskToolbar')).click().then(function()
{
console.log('We clicked on the element btnSolveTaskToolbar');
});
},6000);
Can someone help me? Thanks in advance!
driver.wait(until.elementLocated(By.id('radRadioSub')), 24000,
'radRadioSub not located');
^ That is the line that is failing, and that is caused by an element with id radRadioSub not being found. Look in your page source and find the correct ID.

on(keyPress "<Enter>") in AS2 doesn't work

I have a flash movie I am making that has a search box and a search button. The button has this code:
on (release, keyPress "<Enter>") {
searchbox.execute();
/*the function above processes searches*/
}
Clicking on the button works just fine. Pressing Enter doesn't do a bean! Does anyone know why this is, and any ways I can work around it? I'd prefer not to use listeners if I can possibly avoid it at all.
Using on() is a deprecated AS1 practice, so maybe you should just stop using it. Thanks to the onKeyDown event handler of the MovieClip class, it is possible to use proper code to do it without listeners, so you don't have to worry about them. ;)
Anyway, on with the code. Type this into the timeline which contains the button:
//Enable focus for and set focus to your button
searchButton.focusEnabled = true;
Selection.setFocus(searchButton);
//The onRelease handler for the button
searchButton.onRelease = function(){
//You need this._parent this code belongs to the button
this._parent.searchbox.execute();
}
//The onKeyDown handler for the button
searchButton.onKeyDown = function(){
//Key.getCode() returns the key code of the last key press
//Key.ENTER is a constant equal to the key code of the enter key
if(Key.getCode() == Key.ENTER){
this._parent.searchbox.execute();
}
}

how to get window width and height with YUI?

How do I get those values? I see the example on the YUI page to do this but using a click event, and then calling the get('winWidth') method on the event target. But how can I get these values without the use of any event? Thanks
Simply
YAHOO.util.Dom.getViewportWidth();
YAHOO.util.Dom.getViewportHeight();
keep in mind you can reduce YUI namespace as shown bellow
(function() {
var Yutil = YAHOO.util,
Ydom = Ytil.Dom;
Ydom.getViewportWidth();
Ydom.getViewportHeight();
})();

How to "chain" modal dialogs in YUI 2?

I have a modal dialog box presented in Yahoo UI. The user selects a value from dialog "A", and then I want to present another modal dialog box to collect some more data in dialog "B".
I have been using the YAHOO.widget.Dialog successfully. The problem seems to be that you can't initiate dialog window "B" from the handler function of dialog "A". So, how can you programmatically launch a second dialog window after the user hits the "OK" button on the first ?
(I had tried to create an additional Listener for a field that is updated in dialog "A" to trigger dialog "B" but this doesn't work either.)
Thanks..
Check out the documentation: http://developer.yahoo.com/yui/container/dialog/#events. The following code should do the trick:
var firstDialog = new YAHOO.widget.Dialog('firstDialog', { postmethod: "manual" });
firstDialog.manualSubmitEvent.subscribe(function (type, args) {
var nextDialog = new YAHOO.widget.Dialog('nextDialog', { });
/* more configuration stuff... */
nextDialog.render();
nextDialog.show();
});
firstDialog.render();
firstDialog.show();
This handles when the form is to be submitted, which I think what you mean by selects a value, but if not let me know and I can give some help on that situation.

Resources