I'm working on some scripts for a CRM 2011 project and it really is a tedious task. The only way to upload scripts is by copying the code into a basic text editor and saving it as a web resource.
I have a number of functions which do basic show/hide stuff but the thing I hate is that you have to go into a given field in design view, click on the properties for that field and then add the event to the onchange function (all this is done by far too many clicks).
An example... on a given dropdown list I may call a function called MyFieldInit...
Now, instead of me having to add this method in design view I'd like to be able to add the function to run 'onchange' during the page load code.
In the past I have used jQuery to do some stuff on page load like associating a given dropdown with a given function. The problem I can see is around getting and setting the events on a CRM page. The code is something like:
Is there any way I could use jQuery with these Xrm.Page items to assign associations on page load rather than having to do it to each item in my design view? I have tried using the .setValue("onchange", functioname) but that didn't appear to work. I think not all javascript will work...it seems to be very picky.
Hopefully someone can make sense of this!
I have a number of functions which do basic show/hide stuff but the thing I hate is that you have to go into a given field in design view, click on the properties for that field and then add the event to the onchange function (all this is done by far too many clicks).
An example... on a given dropdown list I may call a function called MyFieldInit...
Code:
function MyFieldInit() {
//do something here
}
Now, instead of me having to add this method in design view I'd like to be able to add the function to run 'onchange' during the page load code.
In the past I have used jQuery to do some stuff on page load like associating a given dropdown with a given function. The problem I can see is around getting and setting the events on a CRM page. The code is something like:
Code:
Xrm.Page.getAttribute("my_field_name").getValue();
or
Xrm.Page.getControl("my_field_name").setVisible(false);
Is there any way I could use jQuery with these Xrm.Page items to assign associations on page load rather than having to do it to each item in my design view? I have tried using the .setValue("onchange", functioname) but that didn't appear to work. I think not all javascript will work...it seems to be very picky.
Hopefully someone can make sense of this!