[Nitro] Error Handling and Reloading

Matthew B Gardner weather at speakeasy.net
Sun Dec 16 04:00:39 EST 2007


Hello --
	I've been googling and looking through the rdocs for some time now, and I 
can't find Nitro's answer to this issue: If someone enters an empty field on 
Form, reload the page without losing the entered data from the other fields 
and print the appropriate error message. As far as the reloading (without 
losing the entered data) goes, I'm really not sure how to do that. However, I 
found a couple references to error handling, but it's not working as I expect 
it to from those examples. To keep it simple, here's what I'm trying to do:

template...
<form>
	...
	#{flash[:err]}
	<input type="text" name="body" size="45" />
	...
</form>

controller...
def form_foo
	obj = request.assign(TestObj.new)
	if obj.body,empty?
		flash[:err] = "No blank entries!"
		# reload the page with the entered data...
	...
end

I've tested the error handling a couple different ways, and I can't get it to 
print. Hopefully my question is clear enough, but please let me know if it's 
not.

Thanks for any help,
Matt


More information about the Nitro-general mailing list