Skip to content

coryhammon1/AjaxFormable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

Description:

AjaxFormable is a scala trait that adds ajax form functionality
to a Lift Record class.

Usage:

Add the trait to your Record and MetaRecord classes, override the
formFields attribute, and call the toAjaxForm function in the
appropriate html.

Example:

class Bulletin extends Record[Bulltin] with AjaxFormable[Bulletin] {
	def meta = Bulletin

	object title extends StringField(this, 64)
	object text extends TextareaField(this, 256)

	override def formFields = List("title", "text")

	override def toXHtml =
		this.toAjaxForm(Full("Change Bulletin")) { bulletin =>
			bulletin.save()
			Alert("Bulletin was changed successfully.")
		}
}

object Bulletin extends Bulletin with AjaxFormableMeta[Bulletin] {
	def getCreationForm =
		ajaxCreationForm(Full("Add Bulletin")) { bulletin =>
			bulletin.save()
			Alert("Bulletin was added successfully.")
		}
}

About

Adds ajax form functionality to a Lift Record

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published