Create a new student

4 views
Skip to first unread message

Dave Briccetti

unread,
Nov 17, 2012, 5:33:17 AM11/17/12
to dbsc...@googlegroups.com
I’m working on Create a New Student.


I need to validate the data, check for duplicates, and then save the record and redirect to the student details page. 

Comments?

Diego Medina

unread,
Nov 17, 2012, 8:07:03 AM11/17/12
to Dave Briccetti, dbsc...@googlegroups.com

I normally add a companion object to the snippet class and include all the validation and extra logic there. This makes testing easier.

For validation I use scalaz validation. From the submit button, I would encapsulate all the form data with a case class, and pass it to the validation method in the companion object.

One of the many validations could be checking for duplicated entries.

One question, is the numeric id from from some external source?

Hope that helps.

Sent from my tablet
Diego

--
 
 

Dave Briccetti

unread,
Nov 17, 2012, 6:06:28 PM11/17/12
to dbsc...@googlegroups.com, Dave Briccetti
Would you integrate scalaz validation with Record validation? And Screen?

The student ID comes from the schools’s student information system. In the current system, there is a way to import students from reports from the SIS, but there isn’t an automated keep-in-sync integration, so they are done manually.

Dave Briccetti

unread,
Nov 17, 2012, 9:05:04 PM11/17/12
to dbsc...@googlegroups.com, Dave Briccetti
I’m playing with Record and LiftScreen. 


Need to get fields ordered, for one thing.

Diego Medina

unread,
Nov 17, 2012, 9:40:55 PM11/17/12
to Dave Briccetti, dbsc...@googlegroups.com
On Sat, Nov 17, 2012 at 6:06 PM, Dave Briccetti <dcbri...@gmail.com> wrote:
> Would you integrate scalaz validation with Record validation? And Screen?
>

I have only used Mapper and never used Mapper's validation, not that
there is anything wrong with it, but I just didn't find a good example
when I needed it, but I did have a very good example on scalaz
validation. At work we use scalaz validation all over the place, from
Lift and also from other non ui systems and it works really well.


> The student ID comes from the schools’s student information system. In the
> current system, there is a way to import students from reports from the SIS,
> but there isn’t an automated keep-in-sync integration, so they are done
> manually.


Ah ok, in this case, if you go for a normal snippet, I would make the
student id an ajaxText field, and the closure of it would call a
function that would look up the entered number on the db and give
instant feedback if the user is already present.

Thanks

Diego

>
> --
>
>



--
Diego Medina
Lift/Scala Developer
di...@fmpwizard.com
http://www.fmpwizard.com
Reply all
Reply to author
Forward
0 new messages