Ajax call from form/ control app

I want to place an image field on a form and detect a click from javascript. When clicked, I would like it to execute some php code by ajax.

How can this be achieved with SC?

In your From go to Fields ->New Field->HTML Image.
Put it where you want on the form.
Then go to Ajax Events and select that Field as your object.

had tried: clicking the image does nothing. see the screenshot (my aim is not to reload the page, was just fiddling around)

I just did sample on a form with an Ajax event, onCLick of a field… and it works fine.

Go into debug mode and make sure your Ajax error output is turned on as well.

Also, I have had issues with the Ajax on forms. If I set it up, then make changes to the form fields, the Ajax breaks.
Try rebuilding it.

Thanks, it works for regular fields but still ignores an image field (which I’m trying to use like a button not placed in the standard locations of top or bottom of the form).

ok… try deleting the image field and make a new one with the same ajax code, just be sure to rename the field to something different.

If that fails then try something like this on the On Record event, but then you would have to reload the page.

{reload} = “<a href=“javascript:void%200” onclick=“window.location.href=’…/super_post_select_school’+’?schoolid=”.[schoolid].”’;" >";

will give it shot, thanks

1 Like