I have a form where users can enter an isbn and it will try to lookup book data and save it.
When validation fails for the isbn lookup (for example if somebody entered it incorrectly), I would like it to redirect to another form where users can enter data in manually if the isbn lookup fails (but not if other validations like numerical price fail).
Any ideas on how to do this? Thanks for the help!
Trying to understand what you’re trying to do: please correct me if my assumption is wrong.
If you can’t save the model because the ISBN failed validation and you want to display a form for just the ISBN since the other fields are OK, there’s a couple things you can do to hold the other attributes in the meantime:
If you can’t save the model then there doesn’t seem to be any reason for redirecting to another action: the user is still trying to complete the
createaction, except you want to render a different form for just the ISBN.Here’s how I’d do it using session, so you can adapt this for redirecting to another action if you need to: