javascript for enabling/disabling 2 date range/date in Cognos - javascript

I am looking for javascript for enabling/disabling two date range/date
prompts in Cognos.
Does anyone have any javascript for disabling/enabling two date range prompts? If I select the Date1 prompt, then the Date2 prompt has to be greyed out and vice versa.
I am using Cognos 8.3 SP2.

How about taking the approach of conditionally rendering one date prompt or another based upon a selection from a radio button or combo box? Doing this would ensure that only one prompt is selected, and would not require javascript.

First off, I'll admit I usually put jQuery into my Cognos reports nowadays. If you don't have the ability to put it into a local library, you can link to the Google hosting of it. You do this using an HTML Element with a script tag inside it (detailed explanation here).
Second, you can put HTML Element (div or span tags with an id) around the prompts. This gives you a way to easily select them.
Third, you bind a function to each one (using .click() ) which uses the .hide() jQuery function on the other.

Related

CKEditor: Possible to invoke action by double-clicking on text inside editor?

I've googled and found nothing, so here I am. If this is in the CKEditor documentation, I haven't found it there either.
The powers that be want a user to be able to double-click on a piece of text (say, a word) in CKEditor, and have that be able to open up a new HTML element outside of CKEditor (such as a Bootstrap Modal). Is this even possible, and if so, how do I go about it?
For example, I've written a separate "Agenda Builder" which is really just where you pick some stuff from drop downs like the name of a meeting room, how many seats you'll need, etc, and enter some dates and times. That all gets saved to the database. But in the text in CKEditor, they want to be able to double-click on [[agenda]] and have it then open up that feature for the user to create their agenda and save it (an entirely separate thing from CKEditor), and then later I will "insert" the agenda into the document in place of the [[agenda]] tag. Make sense?
Thanks!
I think I manage to find the answers to these after posting the question... here's what I came up with:
editor.on('doubleclick', function(e) {
var element = e.data.element.$.innerText;
if (element =='[[agenda]]' ) {
alert("clicked on agenda");
}
});
We solved this exact scenario by creating a CKEditor Plugin(for our own use). When you highlight a word and select a drop down from the plugin, it edits the element highlighted.
In our scenario we used an Angular directive for the navigation.

Getting dropdown selected value on change using DOJO script

Hi I am working on DOJO website and I need to get the dropdown selected value without redirecting to another page using DOJO script or Plain javascript(No jquery, because dojo website not supporting Jquery).
Here is my scenerio
View account
View payment
address change
FAQ
You want the value selected from a drop down box but the act of selecting the value in the first place causes a redirect? You mean the values are coded as links? If so then you need to find the code where the value is used as a link and write some condition to get the value rather than let the click redirect.
If you just want the currently selected value then you need to find the same code, where it was processed as a link, and set a variable there that you can use for your purposes.

Polymer custom elements interfering with each other

I wrote a custom Polymer element that lets the user pick a month. You can look view the code at https://github.com/HoverBaum/month-picker
No I want to use this to select a range of dates. So the user should select a start and and end.
I added two of my elements to a page, to try this out. However for some reason I can only change the selection of the second element. This looks like the two are somehow interfering with each other. Usually I would say "of cause they use the same ids etc." but I was thinking Polymer would take care of these things.
Here is my little demo page:
<div id="timespan">
<span>Start <month-picker></month-picker></span>
<span>End <month-picker></month-picker></span>
</div>
The way the works is that it shows the selected date and when you click it a dialog is opened that lets you change the selected month. But for some reason both element only open the dialog for the second .
Was able to solve this problem by sticking more closely to the Polymer syntax. I was trying to not define everything in the options object handed the Polymer function. As it turns out that prevented me from accessing the right dialog.

How to have Anytime datepicker firing selectively

I am using the Anytime datepicker on some input elements.
This is how it's set on an element:
AnyTime.picker(element_id)
With element_id being a string containing the id of the element.
When the element is clicked, it brings up the Anytime datepicker control.
It works OK, but I want to prevent it from firing in some situations, if some conditions are met. I can't seem to find a decent way to do that.
More specifically, I want to inhibit it when browsing from a mobile device, and use the HTML5 date dialog instead (or just a text input, if it's not available). I've found a way to have the HTML5 date dialog show up when the site is in "mobile layout", using media queries in JavaScript (window.matchMedia()), but I end up with both Anytime and the HTML5 date dialog tied to to the element, and clicking it will bring up both. I want Anytime to not show up in this case...
I can't find anything that works, short of modifying the Anytime source to fire only conditionally...
I've tried removing the datepicker with Anytime_noPicker(), but it doesn't work, and it would be a very un-elegant solution anyway, if it did work.
Instead calling AnyTime.picker() every time, you can put it inside the else condition for your window.matchMedia() test. For example:
if ( window.matchMedia(...) )
// use input type="date" here
else
AnyTime.picker('element-id');
Another answer that might be a better solution for you is to test whether the browser is actually supporting the type="date", and only invoke AnyTime.picker() or $().AnyTime_picker() if it does not. For example:
if ( document.getElementById('my-date').type != 'date' )
AnyTime.picker('my-date',{...});

Selecting Data on JavaScript popup menu using Selenium

I am using Selenium to test out a web site. The web site contains a date field, which when clicked, opens a popup from wherein I can choose the date.
My issue is that I wish to select a particular date using the Selenium IDE or Selenese. I have tried various methods, but have not been able to get a correct solution or been able to resolve it, except by manually specifying a date to the field in Selenese script. I am using Java to implement the test case.
An example could be checked by going to any airlines site and clicking on the date field for departure. The popup which comes up, I wish to capture a date on that. This could be a future date or the present date.
You need to implement some code that will navigate calendar to the desired date. Depending on the calendar appearance it may be required to navigate to the next month or year, so you need the code that will determine what needs to be done and then emulate required events for Selenium.
We had the same task in our tests and we end up with either selecting today's date or by entering the date into the field directly. We also made a code that will allow to select any date on the calendar by we did this only because we needed to test the calendar widget and we were the authors of the widget so we knew how it was made. However it resulted in writing a lot of code
Selenium IDE is limited in its ability to handle javascript. I've worked around it at times
by putting custom links in that do customized GETs, but it's a hack.
You could look at Sahi, which can do it. I haven't tried it though.
http://sahi.co.in/w/

Categories