Changeset 138 for trunk/grails-app/controllers
- Timestamp:
- Jan 26, 2010, 4:46:01 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/dbnp/studycapturing/WizardController.groovy
r105 r138 2 2 3 3 import dbnp.studycapturing.* 4 import dbnp.data.* 4 5 import grails.converters.* 5 6 … … 49 50 flow.pages = [ 50 51 [title: 'Study'], // study 51 [title: ' Twoooo'],52 [title: ' Trois']52 [title: 'Subjects'], // subjects 53 [title: 'Form elements demo page'] 53 54 ] 54 55 … … 75 76 } 76 77 on("next") { 78 // create date instance from date string? 79 // @see WizardTagLibrary::dateElement{...} 80 if (params.get('startDate')) { 81 params.startDate = new Date().parse("d/M/yyyy", params.get('startDate').toString()) 82 } 83 77 84 // create a study instance 78 85 flow.study = new Study(params) … … 80 87 // validate study 81 88 if (flow.study.validate()) { 89 println "ok" 82 90 success() 83 91 } else { … … 87 95 error() 88 96 } 89 }.to " pageTwo"97 }.to "subjects" 90 98 } 91 99 92 100 // render page two 93 pageTwo{94 render(view: "_ two")101 subjects { 102 render(view: "_subjects") 95 103 onRender { 96 println "render page two"97 104 flow.page = 2 105 106 if (!flow.subjects) { 107 flow.subjects = new LinkedHashMap() 108 } 98 109 } 110 on ("add") { 111 def speciesTerm = Term.findByName(params.addSpecies) 112 113 // add x subject of species y 114 (params.addNumber as int).times { 115 def increment = flow.subjects.size() 116 flow.subjects[ increment ] = new Subject( 117 name: 'Subject ' + (increment+1), 118 species: speciesTerm 119 ) 120 } 121 }.to "subjects" 99 122 on("next") { 100 println "next page!" 123 // got one or more subjects? 124 if (flow.subjects.size() < 1) { 125 error() 126 } 101 127 }.to "pageThree" 102 128 on("previous") { 103 println "previous page!" 129 // handle data? 130 // go to study page 104 131 }.to "study" 105 132 } … … 114 141 on("previous") { 115 142 println "previous page!" 116 }.to " pageTwo"143 }.to "subjects" 117 144 } 118 145 }
Note: See TracChangeset
for help on using the changeset viewer.