ajaxToolkit PopupControlExtender not working. Outdated? - javascript

I'm followed this tutorial but I'm getting runtime error when mouseover:
Sys.ArgumentUndefinedException: Value cannot be undefined. Parameter
name: type
The problem is in this lines of code:
string OnMouseOverScript = string.Format("$find('{0}').showPopup();", behaviorID);
string OnMouseOutScript = string.Format("$find('{0}').hidePopup();", behaviorID);
img.Attributes.Add("onmouseover", OnMouseOverScript);
img.Attributes.Add("onmouseout", OnMouseOutScript);
Any thoughts on this? My goal is to get details of gridview row when mouseover a specific column, like the demo on the referenced linked.

Solved by updating AJAX Control Toolkit to it's last version (v15.1 from March 2015)!

Related

Dynamics 365. Field value (javascript)

How can I get field value in Dynamics 365 with JavaScript?
In browser console function Xrm.Page() return undefined.
And when I try get some attribute like a
Xrm.Page.getAttribute("new_city").getValue();
receive error in browser console:
Unable to get property 'getValue' of undefined or null reference
There are two ways you can approach this issue
In the 'target' dropdown in the top right corner of your Developer Tools window, switch to 'Client API Wrapper'. You should then be able to access the form with your javascript code. Your syntax is correct.
Append the beginning of your code with frames at index 0
example:
var city = frames[0].Xrm.Page.getAttribute('bah_city').getValue();
Good luck!
It seems that you havent select the right frame, in the upper left corner of the console you should changed to customScriptsFrame and execute you code
Hope it helps.
Regards
Xrm.Page() probably isnt a method that exists. Try Xrm.Page instead.
For Xrm.Page.getAttribute("new_city"), are you certain:
The field is on the form.
The field name is spelt correctly.
Your code:
Xrm.Page.getAttribute("new_city").getValue(); should work.
Make sure you are using the Name exactly as it is seen in the Field Properties.
Possible reasons are given in other answers.
To avoid errors, always use null check.
if(Xrm.Page.getAttribute("new_city") != null)
var city = Xrm.Page.getAttribute("new_city").getValue();
If you are using this field in header, then use this:
Xrm.Page.getAttribute("header_new_city").getValue();
If you are using this field in Business Process Flow, then use this:
Xrm.Page.getAttribute("header_process_new_city").getValue();

Can't access object in jquery (prevObject?)

A function in my WP plugin has just randomly (as far as I can tell) stopped working.
Here's the code in question:
window.send_to_editor = function(html) {
var classes = jQuery('img',html).attr('class');
var items = classes.split(" ");
... more stuff here
}
I've confirmed that the html variable is indeed an img html tag. Here's what firebug shows when I do a console.log of the object (console.log(jQuery('img',html));):
Object[]
context -> undefined
jquery -> "1.11.2"
length -> 0
prevObject -> Object[img.alignnone.size-full.wp-image-1234 name.jpg]
And the error it shows is classes is undefined.
I figure there's something wrong with the object I get, but this used to work recently and I'm not aware of any changes in the site that could have caused this.
I'd appreciate any input on this.
EDIT:
More info. This happens with two plugins which are supposed to be unrelated (made by different people). It happens when, after uploading an image to the server (or selecting a previously uploaded picture) you try to insert it into the post.
As I said before this error has appeared out of nowhere, it was working as intended a couple days ago. The only thing I can think of that has changed since then is the domain name, but I can't see how that could be related.
The jQuery selector always returns a jQuery object, but when the length is 0 then no elements were found matching the selector that you provided. In your example you've confirmed that nothing is selected as the length of the jQuery object is 0. Perform a check whether an element was selected like this:
var $els = jQuery('img',html),
classes;
if ($els.length) {
classes = $els.attr("class");
}
Keep in mind that your DOM query is limited by what you pass in as the html parameter. If you simply want to find the images on the page do: var $els = jQuery('img');
I finally managed to fix this; the key was parsing the html string variable into proper HTML, using jQuery.parseHTML(). Thanks to everyone who helped!

Jasper Reports - HTML5 Reports(highcharts) - String Replace for Labels

Hoping someone can help. Trying to do a string replace on the labels for my bar chart. So this is built on jasper studio and is a html5 report.
Trying to add the replace function as a javascript function in the report "Advanced Properties". Previously I have successfully set a function here for xAxis.labels.formatter to append labels,
"function(){return this.value.toString().substring(0,5)}"
I have tried to update this for string replace and came up with the below:
"function(){return this.value.toString().str.replace("Section7","W3Schools")}"
This is not working.I dont have much javascript experience and I have tried different formats of the above but no luck so far, any suggestions would be much appreciated?
Got it working. The replace function, works with the below:
Set property name as:
xAxis.labels.formatter
Use as expression:
true
3.Property Value:
"function(){return this.value.replace(\"Section 7\",\"W3Schools\")}"
Or
<hc:chartProperty name="xAxis.labels.formatter">
<hc:propertyExpression><![CDATA["function(){return this.value.replace(\"Section 7\",\"W3Schools\")}"]]></hc:propertyExpression>
</hc:chartProperty>

Passing Javascript Object to Function & changing text field

This is probably a stupid mistake that i have made; i am still new to web development so be nice please :)
Here i create the object
var crs0 = {ID:1, TITLE:"test", DESC:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",ER:"a",LENGTH:"a", FEE:"a"};
Here i use an onclick event to call a function & pass the object as a parameter
<div class = "btnDC" onclick="display(crs0)">test</div>
Here is the function that i use to replace data in some textarea's & text inputs with properties from the object.
function display(crs)
{
document.getElementById("ttl").value=crs.TITLE;
document.getElementById("dsc").value=crs.DESC;
document.getElementById("er").value=crs.ER;
document.getElementById("lng").value=crs.LENGTH;
document.getElementById("fees").value=crs.FEE;
document.getElementById("ID").value=crs.ID;
}
The onclick does nothing & i have no idea why. (Other javascript on the page does work so i haven't missed a semi-colon :D )
[Update 1]
All of the data is pulled from a database the code above is copied from the page it produces; i have done a few tweaks & i can get it to produce an alert box for the display function however if i try & make it show any data of the object within that alert box it doesn't display anything (i hate not having a debugger), which suggests that the object isn't being passed.
Here is the PHP code i use to create the onclick
echo '<div class = "btnDC" onclick="display(crs'.$n.')">'.$inf['TITLE'][$n].'</div>
Could that be the issue?
it produces this line of code
<div class = "btnDC" onclick="display(crs0)">test</div>
As mentioned the code i have shown works (thanks juvian);
I generated this code from php & although the javascript generated was correct there was a problem with some of the php, i didn't find the exact problem but i have re-written most of the php & now it works.
As mentioned the code i have shown works (thanks juvian); I generated this code from php & although the javascript generated was correct there was a problem with some of the php, i didn't find the exact problem but i have re-written most of the php & now it works.

deleting a column in a table javascript

I'm developing a JavaScript application using Google Visualization API. I wrote a event listener so whenever the user clicks in the column, he has the option to hide it, if he does not want to see it.
google.visualization.events.addListener(table, 'select',
function selectHandler(){
var data_table = table.getDataTable();
confirm("hide column?", "Yes", "No");
alert(data_table.removeColumn(0));
}
);
I get the following error:
data_table.removeColumn is not a function
alert(data_table.removeColumn(0));
The API description can be seen here. It's interesting why the first alert tells me "30", the number of columns in the table, while the removeColumn(index) function does not do anything at all. Any Thoughts?
Thanks
Is it because your code snippet invokes removeColum instead of removeColumn?
I assume you're saying that the second two alerts don't happen.
If so, it's probably because of this typo...
// -----------------------v
alert(data_table.removeColum(1)); // missing "n"
I suspect that perhaps data_table is not, in fact, not the type of object you expect.
Have you used console.dir to look at the methods available on it?

Categories