Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
question about onGenerate event
plantronics
Seems that functions tied to the onGenerate event in FormAPI are kicked off even if the DCR is not saved or contains incomplete fields.Is there a workaround for this?
For example, the way it works now, the user hits generate, the onGenerate event is fired, but the fucntion that is attached returns an error if some fields are incomplete (the function relies on these fields being complete). Ideally, the way it works would be, the user hits generate, Teamsite validates the form, asks if they want to save, they hit yes, and then the onGenerate event is fired.
I do not want to use an onSaveValid event since I dont know if the user will be generating or not, and this function should ONLY be called when generating, not saving.
Find more posts tagged with
Comments
Johnny
One approach could be to return from your function if the form is modified.
EG
function handleOnGenerate() {
if ( IWDatacapture.isModified ()) { return; }
do_stuff();
}
John Cuiuli
Johnny
Actually that may not help as you want your function to run *after* everything is valid and saved.
I can't think of a clean solution - I'm surprised this is not handled by the event.
John Cuiuli
cliffhanger
Ideally, the way it works would be, the user hits generate, Teamsite validates the form, asks if they want to save, they hit yes, and then the onGenerate event is fired.
I also agree that that's how I would expect onGenerate to work.
If you're looking for a workaround, you could invoke IWDatacapture.save() in your onGenerate handler. You could also keep a flag that onSaveValid/onSaveDone handler could use to decide whether to call onGenerate handler function or not.