Friday, December 26, 2008

Prepend javascript to an action button - Portlet Factory

I am creating a form, which is submitted and a thank you page is display. Only the Form section is change to Thank You after submission, without refreshing the whole page.

I used a Button builder and set that in the Post-Action Behavior. The issue that I had was when submitting, the button stays active. If the connection is fast, it does not matter but when I was working at a slow connection place, when submitting, it takes a few seconds before the Thank you page shows but the button is still active.

The button calls an action. I want the button to run additional Javascript before running the action. From the forum, I manage to find the solution.

The HTML Event Action can be used. Select the location you want to insert the javascript. Action type, I use "Run a script". Then put in the javascript. In Advance, use Prepend new value.

This is very useful to add in more actions before the button action is triggered.


juliet said...
This comment has been removed by a blog administrator.
Gadwin Co Inger said...

Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Front end developer learn from Javascript Training in Chennai . or learn thru Javascript Training in Chennai. Nowadays JavaScript has tons of job opportunities on various vertical industry. JavaScript Training in Chennai