Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Triggering javascript on bizform using ajax View modes: 
User avatar
Member
Member
simon - 2/13/2013 1:21:37 AM
   
Triggering javascript on bizform using ajax
Hi,

I have a bizform that i need to validate. The bizform contains an a field that i've hidden and is populated via a jQuery plugin i wrote as the display requires selection of 4 images. This works great.

Its been requested that the form validates via ajax. Ticking the "enable ajax" on the bizform container does the trick, but I cant get the JS to run to create the images.

I've tried cloning the bixform container, and in the OnContentLoaded() function put
ScriptHelper.RegisterStartupScript( viewBiz, typeof(string), "blah", "<script type='text/javscript'>var a = function(){alert('blah');};a();</script>" );

but it doesnt run. If i modify the script function to be invalid i'll get a 500 error. but I cant get it to alert at all.

Any ideas on what i'm doing wrong ?

User avatar
Member
Member
simon - 2/13/2013 7:19:48 PM
   
RE:Triggering javascript on bizform using ajax
I fixed my issue by making the js image checkboxes default, turning of ajax panel and using jquery validate to stop the form submitting if invalid.

but i'd still like to know how to trigger JS on ajax reload as we use it a fair bit in some projects. I'm a bit of a asp noob.

Any one have any ideas ?

User avatar
Certified Developer 8
Certified Developer 8
Petr Dvorak - 2/14/2013 4:03:21 AM
   
RE:Triggering javascript on bizform using ajax
Hi Simon,

you can try to attach your own JavaScript callback to PageRequestManager endRequest Event:
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(function (e) { alert('hi'); });