views:

57

answers:

1
def createFlow = {
  println "1"
    def conferenceInstance = new Conference () 
   start {
   println "2"
   action {
    println "3"

    flow.planAccountExistList = Account.findAllByPlanIsNotNullAndCustomer(session.customer)  
    println "4"
    }
   println "5"
   on('success').to('accounts')
   println "6"
  }
  accounts {
   println "7"
   on('submit') {
    println "8"
    conferenceInstance.properties = params
    println params
    println "9"
   }.to('features')
   println "10"
  }
  features {
   println "11"
   on('submit') {
    println "12"
    conferenceInstance.properties = params
    conferenceInstance.maxParticipants = params.maxParticipants
    println conferenceInstance.maxParticipants
// i can't take the value of params maxParticipants from gsp it returns null.//
    println "13"
   }.to('emails')
   println "14"
  }
  emails {
   println "15"
   on('submit'){
    println "16"
    conferenceInstance.properties = params
    println params
    println "17"
    if (!conferenceInstance.hasErrors() && conferenceInstance.save()) {
     println "18"
     return success()
    } else {
    println "19"
     return error()
    }
   }.to('flowList')
   println "20"
   on('success').to('flowShow')
   println "21"
   on('error').to('flowEdit')
   println "22"
  }
  flowShow {
   println "23"
   redirect(controller: 'Conference', action: 'show', params: [id: conferenceInstance.id])
   println "24"
  }
  flowDelete {
   println "25"
   redirect(controller: 'Conference', action: 'delete', params: [id:conferenceInstance.id])
   println "26"
  }
  flowList {
   println "27"
   redirect(controller: 'Conference', action: 'list')
   println "28"
  }
  println "29"
 }



gsp:

                         <tr class="prop">
                                 <td valign="top" class="name">
                                     <label for="maxParticipants">Max. Participants</label>
                                 </td>
                                 <td>
                                                    <input type="text" name="maxParticipants" />
                                 </td>
                             </tr>

i can't take the value of params maxParticipants from gsp it returns null what is the error and how can i solve it thx a lot

A: 

def createFlow = { start { action { flow.planAccountExistList = Account.findAllByPlanIsNotNullAndCustomer(session.customer) } on('success').to('accounts') } accounts { on('submit'){ flow.description = params.description flow.account = params.account flow.fromTime = params.fromTime flow.toTime = params.toTime }.to('features') } features { on('submit'){ flow.maxParticipants = params.maxParticipants flow.managed = params.managed flow.recorded = params.recorded }.to('emails')

on('previous'){ flow.description = null flow.account = null flow.fromTime = null flow.toTime = null }.to('accounts') } emails {

on('previous'){ flow.maxParticipants = null flow.managed = null flow.recorded = null }.to('features')

on('submit') { Random random = new Random() def conferenceInstance = new Conference (params) conferenceInstance.conferenceNumber = randomService.getRandomDigits(8) conferenceInstance.adminPassword = randomService.getRandomDigits(4) conferenceInstance.managerPassword = randomService.getRandomDigits(4) conferenceInstance.userPassword = randomService.getRandomDigits(4) conferenceInstance.description = flow.description conferenceInstance.account = Account.findWhere(id:flow.account) conferenceInstance.createDate = new Date() conferenceInstance.lastUsedDate = new Date() if (conferenceInstance.toTime == null ){ conferenceInstance.toTime = new Date() }else{ conferenceInstance.toTime = new Date().parse("yyyy-mm-dd HH:MM:ss", flow.toTime) } if (conferenceInstance.fromTime == null){ conferenceInstance.fromTime = new Date() }else{ conferenceInstance.fromTime = new Date().parse("yyyy-mm-dd HH:MM:ss", flow.fromTime) } conferenceInstance.maxParticipants = Integer.parseInt (flow.maxParticipants)

if (conferenceInstance.managed == null){
 conferenceInstance.managed = false
}else{
 conferenceInstance.managed = flow.managed
}
if (conferenceInstance.recorded == null){
 conferenceInstance.recorded = false
}else{
 conferenceInstance.recorded =flow.recorded
}

if (conferenceInstance.save(flush: true)) {

 redirect(action: "show", id: conferenceInstance.id)
}
else {
 //render(view: "list", model: [conferenceInstance: conferenceInstance])
}

}.to('flowList') flowList { redirect(controller:"customer",action: "show") } } }

mbayloon