We're currently trying to replicate existing Siteb...
# suitecommerce
d
We're currently trying to replicate existing Sitebuilder customisations with SCA and finding that a lot of what we need to do is seemingly outside the bounds of the extensibility API. If, for example, I wanted to ensure email addresses were always lowercase for new account registrations, I can access form data in the LoginRegisterPage beforeRegister event, but the component appears not to have any methods. Is there any way we can modify the data and return it to the standard registration mechanism? beforeLogin is also a cancelable event, but is there any way to return an error which displays to the user via the standard method, without having to resort to jQuery DOM manipulation?
s
The point of cancellable events is focused on the first part: you want to stop something from happening. So, you if you want to stop a user from registering an account with an email that contains capital letters then yes this is the right method to use. Use the
beforeRegister
event and pass in a callback that tests for caps -- if it contains them then you need to return
jQuery.Deferred().reject()
.
If you want to transform the data after submit then jQuery is the best thing to do. Even if you were writing your own extension with a form, you would still use jQuery events to listen for
submit form
.
Now there isn't really a mechanism to add a new event to a base class view, so my only thought is that you would need to add a new child view to the registration page which listens for
submit form
and then does the transformation in the form. That should work.
You know I was thinking about this and I just remembered that we have the
addToViewEventsDefinition
method on the APi, which lets you inject event definitions into existing views: https://system.netsuite.com/help/helpcenter/en_US/APIs/SuiteCommerce/Extensibility/Frontend/VisualComponent.html#addToViewEventsDefinition
I actually don't think I've used it before but should do what you want?