Help get this topic noticed by sharing it on Twitter, Facebook, or email.
Joel Bair (purlHub Specialist) May 02, 2012 21:57

JSAPI additions 04/25

We've added a few new options to the purlHub JSAPI.


  • autoCaptureProfiles (bool)

  • autoCaptureRecords (bool)



Defaulting to true, both of these serve as defeat controls for disabling the automatic data capture events on profile forms and record forms. These is useful when doing custom save calls.

From user experience, we've found that some 3rd party form validation libraries work best with purlHub when the form submit is only triggered via a validation callback. So, we added the defeat options to support custom coding here. In this case, inside the validation success callback it is necessary to add a call to one of the purlHub utility methods purlService.savePurlProfile() or purlService.savePurlRecord(). This ensures that data capture and form submit are only invoked when the validation code passes.

As always, your feedback is appreciated!

- purlHub
Reply
  • For this, could you not though just do your validation on the form submit action and then when it validates let the form submit method take over like it normally would thereby triggering the autoCapture events. If the validation fails you can just use the e.preventDefault and return false to stop the form postback from attempting and thereby stopping the autoCapture events.

    Would that work?
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly happy, confident, thankful, excited sad, anxious, confused, frustrated indifferent, undecided, unconcerned

  • Joel Bair (purlHub Specialist) May 03, 2012 14:53
    Yes! That's exactly correct. With custom form validation code that leverages DOM level 2 or 3 events, you approach is on target and exactly what was intended with the purlHub JSAPI.

    However, In the case of the moderately popular jQuery.Validate plugin. The submitHandler callback does not support access to the event properties and returning false from the function does not cancel the remaining events.

    In addition, any 3rd party validation plugins that use legacy DTHML methods to invoke validation by assigning the ONSUBMIT attribute of the form will not trigger the autoCapture events (reliably).
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. kidding, amused, unsure, silly happy, confident, thankful, excited sad, anxious, confused, frustrated indifferent, undecided, unconcerned