?
Solved

OnChange Event code is not copying in the fields

Posted on 2012-08-20
15
Medium Priority
?
866 Views
Last Modified: 2012-08-24
Hi Experts,

This is a secondary post from an earlier post. I thought it might be less confusing to start a new post for a new problem.

For some reason the attached code is not copying in the fields. I have used similar code on other entities and it has always works. Why doesn’t it work now?

I do not have Visual Studio installed so it makes it hard for me to see if I’ve missed something. I am not getting any errors either with the OnChange Event or with the save.

Thanks for your help. :)
function-ChangeInspectionSite-re.txt
0
Comment
Question by:jlblanke
  • 9
  • 6
15 Comments
 
LVL 27

Expert Comment

by:Chinmay Patel
ID: 38312843
Hi jblanke,

Check line 280

catch (e) { };

Open in new window


if there is an error this statement will hide it. This is bad programming practice. replace it with

catch (e) { alert(e.message)};

Open in new window


and run the code. Let me know if you get any error message this time.

Regards,
Chinmay.
0
 

Author Comment

by:jlblanke
ID: 38313551
I made the change. I am getting a 'retrieveParentCustomer' error on change.
0
 
LVL 27

Expert Comment

by:Chinmay Patel
ID: 38314214
Hi jblanke,

I will need more than that to figure out what is wrong. Kindly share the exact error message please.

Regards,
Chinmay.
0
Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

 

Author Comment

by:jlblanke
ID: 38315943
Here is the error. It is what I was getting on the previous post. I have attached the code.

There was an error with this field's customized event.

Field:customerid
Event: onchange
Error: Object doesn't support property or method 'retrieveCustomer'.
function-ChangeInspectionSite-re.txt
0
 

Author Comment

by:jlblanke
ID: 38321168
I modified the script (attached). If I  open an existing record and change the field I no longer get any errors. The script removes the old data from the fields; BUT, the new data IS NOT populating in the fields.

If I open a new record and change the field I get the following error:

     There was an eror with this field's customized event.
     Field: customerid
     Event: onchange
     Error: Object doesn't support property or method 'retrieveCustomer'.

Please help. My boss wants this working today and I am unsure of how to proceed because I cannot see where my error is.
modified-function-ChangeInspecti.txt
0
 
LVL 27

Expert Comment

by:Chinmay Patel
ID: 38322335
Hi jblanke,

Sorry I will not be able to look into this matter till Saturday. I suggest you use a javascript debugger or at least start using any one of the IDEs I suggested earlier.

Regards,
Chinmay.
0
 

Author Comment

by:jlblanke
ID: 38322663
Thanks Chinmay. I'll check into those. I'll look forward to hearing from you this weekend. :)
0
 
LVL 27

Expert Comment

by:Chinmay Patel
ID: 38326377
In the mean time, try to learn how to debug JavaScript.
0
 

Author Comment

by:jlblanke
ID: 38326704
Unfortunately I do not have any software tools to help with the debugging. If I get an error which points to a specific line then I manually count the lines of code until I get to the error. You have been very helpful in showing me what to look for when I have been getting some of the errors.

This is a most puzzling problem.

I made some corrections to the script. I am now not getting any errors when I change the field, but I also am not getting the data to update the fields. I will continue to plug away. My manager has given me a brief reprieve, but I know he is looking for results.

I will continue to plug away. . . . :)
0
 

Author Comment

by:jlblanke
ID: 38327097
Well, here's an update. I got the code to populate the fields, but when I do a save, the data in the fields go away.

Any thoughts? I have attached my revised code.
revised-code.txt
0
 
LVL 27

Accepted Solution

by:
Chinmay Patel earned 2000 total points
ID: 38327796
I took a quick look but not sure if there is something wrong with this code or not. I will spend some time on it tomorrow.

And as long as the script debugging is concerned, you can debug your script using Internet Explorer only. You don't need a fancy IDE :). In Internet Explorer press F12 and then.... well... see it for yourself.

Let me put icing on the cake... check this link for more information on Dev Tools : http://msdn.microsoft.com/en-us/library/ie/gg589507(v=vs.85).aspx

Also you could use Free tools I suggested in one of the post earlier. They are free and will allow you to debug the script.
0
 

Author Comment

by:jlblanke
ID: 38329035
Cool!  I did the Internet Explorer F12 debugger. It did not show any breakpoints. I am really stymied on this because the code works on other forms.
0
 

Author Comment

by:jlblanke
ID: 38329427
Not sure what exactly happened. But the code is working now. When I change the field value the subsequent fields are updated. When I save the form (or do a save and close) the new data remains in the fields.

Is is possible that there is a delay between the updates I make and the server refresh?

Thanks for being so patient with me.
0
 

Author Closing Comment

by:jlblanke
ID: 38329438
Thank you for your patience in working with me through this unusual problem. The 'icing' you provided was invaluable and has given me a tool to use on all of my coding problems. It is worth the excellent rating and score.

:)
0
 
LVL 27

Expert Comment

by:Chinmay Patel
ID: 38330053
Hi jblanke,

First of all super thanks for nice words :).

Actually I don't have patience :P so I try to make people independent.. :D and I think in this case it worked out perfectly.

Now to the questions:
- Let me know if you need help with debugging via Dev Tools.
- Yes. It is very important to understand concept of local caching in Browsers. Browsers, by design cache most of the stuff you see on websites(notice most of ) so it is a good chance that Scripts are cached as well so it is a good practice to always clean your browser cache when you are developing Scripts.
 - Also with CRM always remember to Save and Publish your changes :) It can be a culprit sometimes.

Regards,
Chinmay.
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question