Send alert to invalid page

I am using validation on a grid with CF connector similar to:

On it’s own the above works fine.

Is there any way to call a Javascript alert on the HTML (grid) page? I have tried numerous variations on the following (inside the function) with no luck:

WriteOutput (' ');

Can anyone offer any guidance?

During dataprocessor init you can use something like

dp.init(mygrid); dp.attachEvent("onAfterUpdate", function(sid, action, tid){ if (action == "invalid") alert("Your selection is invalid"); return true; });

Yes, that has solved it.

Many thanks Stanislav.

Carrying on from the above can you offer any guidance on how to deal with multiple validation requirements in this context?

I have 2 or 3 different (server side) validation requirements on this grid and would like to fire a different alert depending on which validation didn’t pass.

The validation itself works fine - it is just passing different messages back to the onAfterUpdate event that is unclear.

I can use if (action == “error”) as well as if (action == “invalid”) to get two options but that is not the ultimate solution. The goal is to have a variety of alerts that fire based on which of numerous server side validations don’t pass.

You can transfer extra info back to client

On server side

<cfset action.set_response_attribute("mydata","validation message here")> … ion_object

on client side

dp.attachEvent("onAfterUpdate", function(sid, action, tid, tag){ if (action == "invalid") alert(tag.getAttribute("mydata")); return true; });