optimizely/marketing-website — pull request #573 by dtothefp (2014-10-28 22:46:35+00:00)
Title: refactor ppc form into form helpers

The PR addresses adding processing state to form inputs for the free-trial form layout. Essentially the code was refactored into a form helper giving access to the instances processing state handlers. Inputs are now greyed out during processing state. If the form is successful the inputs will remain disabled until page redirect, whereas if there is a form error or unsuccessful response/JSON parse error the processing will be removed and an error message shown. In addition form helpers have built in if a validation occurs, when the user focuses in to an input, the error state on that input is removed.

Other additions:
-pre fill error message so that the form doesn't 'jump' when error message is shown
-add some margin to the bottom of the form. The button was much too close to the panel bottom and it was bugging me.
-add an else statement to account for if JSON.parse called on the response fails -- essentially processing state is removed here and error message shown.