wrekatlanta / wrektranet

New intranet for Georgia Tech's student-run radio station, WREK.
wrek.org
MIT License
9 stars 2 forks source link

[#23] Require contest book name before submitting form #33

Closed jonathanhunsucker closed 10 years ago

jonathanhunsucker commented 10 years ago

Little different approach from previous example (https://github.com/wrekatlanta/wrektranet/blob/master/app/assets/javascripts/controllers/airPlaylistCtrl.js#L230).

pstoica commented 10 years ago

Oops, I was actually pointing out something different for the on-air section. People are supposed to put down names (listeners/winners) for concert tickets during their shifts, but sometimes they'd forget to hit the "add" button and it never gets saved. So it's a client-side check with a confirmation popup.

So you should be looking at stuff namespaced with /air/ instead of /admin/.

Let me know if you need more details (including what the contest book is for?), today's kind of hectic for me tho.

Our forms pretty much already have HTML5 validations corresponding with model validations.

jonathanhunsucker commented 10 years ago

Whoops, got carried away on the wrong file.

Do you mind that the requirement enforcement is through disabling the button through angular form validation instead of an alert?

pstoica commented 10 years ago

No worries. Well, the requirement validation is still addressing something else, and any modern browser already pops up with a "this field is required" warning if you try to submit. Here's a screenshot of the potential problem:

screen shot 2014-03-04 at 12 36 43 pm

This is where ops write down names for concert ticket winners. Sometimes ops write a name and forget to submit the form and go off to another page; so when there is something in the form and the user leaves the page (onbeforeunload), that's when you want to ask them to confirm. I think I mentioned the files you want to edit in the original issue #23.

Oh yeah, if you want to create test data without going through the admin forms, you can use FactoryGirl factories in the rails console.