Extending Batch Connect app with custom endpoints

I’ve had good success with using ood initializer classes to provide backend data for ERB templates. But, now I’d like to make calls using JS and form.js to validate form data as it’s entered (for example, checking if specified files exist, etc).

What’s the best way to do this? I envision creating custom endpoints/routes, but don’t know if I should do that within the BC app or should elsewhere in the ood/RoR stack.

Thanks,
Lopaka

3.1 shipped with the path_selector widget. It’s a widget that will let the users traverse the file system to choose a text_field. No verification needed because the user didn’t type the path, it was determined by where they were/actual files and directories.

That said - while technically you can use any APIs we have in our stack, they’re subject to change without notification. That is, we use them internally and sometimes folks use them too, but we (the developers) give no guarantees on the stability these APIs. It’s just too burdensome for us to maintain all that we do and also APIs to boot. So if you do find and use them, I would say at your own peril I suppose.

You could additionally hack the distribution, but that’s more maintenance you need to take on when you update to successfully apply your patches. Who knows how your additions will fit into our additions when you go to upgrade. You can safely assume that you’ll have a headache to upgrade when routes or something diverges in a weird way.

I think this is your best bet because it’s likely to work forever without maintenance. You can do this within the submit.yml.erb and catch anything right before the job submits.

So you’d have something like this in your submit.yml.erb to check the file and notify the user before the job ever gets submitted.

raise(StandardError, "the file you've chosen: #{the_file_choice} doesn't exist!") unless File.exist?(the_file_choice)

Jeff, thanks those are good thoughts. The submit.yml.erb method works great (I’ll need to use that as one of our ood installs is still at 1.8 … gasp!)

Final question: Is there a way to change the “Save” title from the exception/message that’s posted?