Search code examples
ajaxruby-on-rails-3transactionsclient-side-validation

Rails advanced client-side validation where additional input is needed


I'm working with the roo gem to process an excel file containing student information that gets submitted by their teachers and this information is then parsed and stored in the database row by row. There are several cases where the input of these excel files are flagged as invalid and require further input from the teacher. The input would correspond to predefined decisions, i.e., yes, no, true, false, cancel.

For instance, if a field is read and gets flagged I want to display a prompt to the teacher asking him to continue processing or to cancel, in which case I would simply continue my loop or rollback respectively.

I was wondering if somebody can give me a basic rundown of what tools I would need, or how I could implement this within a Rails application?


Solution

  • I had no luck finding any examples of something like this, I guess it's just something that isn't done with web applications.

    Unless I see a better suggestion by somebody I think I'll break this up into two separate processes, a validation process which will first process the excel document storing each row into an array of hash fields with their respective error messages back to the user on the redirect. The page to follow will format the array of hashes into a form table with check-boxes and so forth which will be sent back to the controller to be processed a second time and committed.

    Sounds good on paper, but I'll find out for myself if this is actually feasible.