|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
g:form and g:link questionhello I got a small question.
basically I got a g:link like this: <g:link controller="experimentClass" action="attachTo" params="[callingTarget:'Experiment']" id="${fieldValue(bean:experiment, field:'id')}">create Classes</g:link> which works as it supposed to be and shows me my view here: http://127.0.0.1:8080/binbase-scheduler/experimentClass/attachTo/1?callingTarget=Experiment now if I write this as a g:form <g:form action="attachTo" controller="experimentClass" id="${fieldValue(bean:experiment, field:'id')}"> <span class="button"><g:actionSubmit class="create" value="add Classes" /></span> <input type="hidden" name="callingTarget" value="Experiment" /> </g:form> it generates this link: http://127.0.0.1:8080/binbase-scheduler/experimentClass/attachTo/1 which gives me this error message: HTTP ERROR: 404 NOT_FOUND RequestURI=/binbase-scheduler/experimentClass/attachTo/1 Powered by Jetty:// the method attachedTo this: println "attach method: " + params def target = params.callingTarget def experimentClass = new ExperimentClass() experimentClass.belongsTo.each{ p -> Class c = p.getValue() experimentClass[p.getKey()] = c.get(params.id) } def commingFrom = params.commingFrom def commingFromId = params.commingFromId if(commingFrom == null){ println "create new comming from fields" commingFrom = params.controller commingFromId = params.id } else{ println "comming from values where already set" println commingFromId println commingFrom } println "check for errors" if(!experimentClass.hasErrors() && experimentClass.save()) { flash.message = "ExperimentClass ${experimentClass.id} created" redirect(controller:params.controller,action:show,id:experimentClass.id,params:[attached:true,commingFrom:commingFrom,commingFromId:commingFromId]) } else { render(view:'create',model:[experimentClass:experimentClass,attached:true,commingFrom:commingFrom,commingFromId:commingFromId]) } so nothing to complicated as far as I think. can somebody explain me what I'm doing wrong here? I think it's something reall really stupid... thanks, g. -- ----------------------------------------------------------------- gert wohlgemuth blog: http://berlinguyinca.blogspot.com/ work: http://fiehnlab.ucdavis.edu/staff/wohlgemuth --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
AW: g:form and g:link questionHi Gert.
The <g:actionSubmit ...> Tag uses the "value" attribute as title of the button _and_ name of the action, if you don't specify an "action" attribute. So, try: <g:actionSubmit class="create" value="add Classes" action="attachTo" /> HTH, DJ -- Daniel J. Lauk -----Ursprüngliche Nachricht----- Von: wohlgemuth [mailto:berlinguyinca@...] Gesendet: Dienstag, 22. Juli 2008 03:48 An: user@... Betreff: [grails-user] g:form and g:link question hello I got a small question. basically I got a g:link like this: <g:link controller="experimentClass" action="attachTo" params="[callingTarget:'Experiment']" id="${fieldValue(bean:experiment, field:'id')}">create Classes</g:link> which works as it supposed to be and shows me my view here: http://127.0.0.1:8080/binbase-scheduler/experimentClass/attachTo/1?callingTarget=Experiment now if I write this as a g:form <g:form action="attachTo" controller="experimentClass" id="${fieldValue(bean:experiment, field:'id')}"> <span class="button"><g:actionSubmit class="create" value="add Classes" /></span> <input type="hidden" name="callingTarget" value="Experiment" /> </g:form> it generates this link: http://127.0.0.1:8080/binbase-scheduler/experimentClass/attachTo/1 which gives me this error message: HTTP ERROR: 404 NOT_FOUND RequestURI=/binbase-scheduler/experimentClass/attachTo/1 Powered by Jetty:// the method attachedTo this: println "attach method: " + params def target = params.callingTarget def experimentClass = new ExperimentClass() experimentClass.belongsTo.each{ p -> Class c = p.getValue() experimentClass[p.getKey()] = c.get(params.id) } def commingFrom = params.commingFrom def commingFromId = params.commingFromId if(commingFrom == null){ println "create new comming from fields" commingFrom = params.controller commingFromId = params.id } else{ println "comming from values where already set" println commingFromId println commingFrom } println "check for errors" if(!experimentClass.hasErrors() && experimentClass.save()) { flash.message = "ExperimentClass ${experimentClass.id} created" redirect(controller:params.controller,action:show,id:experimentClass.id,params:[attached:true,commingFrom:commingFrom,commingFromId:commingFromId]) } else { render(view:'create',model:[experimentClass:experimentClass,attached:true,commingFrom:commingFrom,commingFromId:commingFromId]) } so nothing to complicated as far as I think. can somebody explain me what I'm doing wrong here? I think it's something reall really stupid... thanks, g. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: g:form and g:link questionthx I give it a try,
I'm still pretty new to grails, but really like the approach sofar. g. On Mon, Jul 21, 2008 at 10:53 PM, Lauk Daniel <Daniel.Lauk@...> wrote: > Hi Gert. > > The <g:actionSubmit ...> Tag uses the "value" attribute as title of the button _and_ name of the action, if you don't specify an "action" attribute. > > So, try: <g:actionSubmit class="create" value="add Classes" action="attachTo" /> > > HTH, > DJ > -- > Daniel J. Lauk > > > -----Ursprüngliche Nachricht----- > Von: wohlgemuth [mailto:berlinguyinca@...] > Gesendet: Dienstag, 22. Juli 2008 03:48 > An: user@... > Betreff: [grails-user] g:form and g:link question > > hello I got a small question. > > basically I got a g:link like this: > > <g:link controller="experimentClass" action="attachTo" > params="[callingTarget:'Experiment']" > id="${fieldValue(bean:experiment, field:'id')}">create Classes</g:link> > > which works as it supposed to be and shows me my view here: > > http://127.0.0.1:8080/binbase-scheduler/experimentClass/attachTo/1?callingTarget=Experiment > > now if I write this as a g:form > > <g:form action="attachTo" controller="experimentClass" > id="${fieldValue(bean:experiment, field:'id')}"> > <span class="button"><g:actionSubmit class="create" value="add Classes" /></span> > <input type="hidden" name="callingTarget" value="Experiment" /> </g:form> > > it generates this link: > > http://127.0.0.1:8080/binbase-scheduler/experimentClass/attachTo/1 > > which gives me this error message: > > HTTP ERROR: 404 > > NOT_FOUND > RequestURI=/binbase-scheduler/experimentClass/attachTo/1 > > Powered by Jetty:// > > > > the method attachedTo this: > > > println "attach method: " + params > def target = params.callingTarget > def experimentClass = new ExperimentClass() > > experimentClass.belongsTo.each{ p -> > Class c = p.getValue() > experimentClass[p.getKey()] = c.get(params.id) > } > > def commingFrom = params.commingFrom > def commingFromId = params.commingFromId > > if(commingFrom == null){ > println "create new comming from fields" > commingFrom = params.controller > commingFromId = params.id > } > else{ > println "comming from values where already set" > println commingFromId > println commingFrom > } > > println "check for errors" > if(!experimentClass.hasErrors() && experimentClass.save()) { > flash.message = "ExperimentClass ${experimentClass.id} created" > > redirect(controller:params.controller,action:show,id:experimentClass.id,params:[attached:true,commingFrom:commingFrom,commingFromId:commingFromId]) > } > else { > render(view:'create',model:[experimentClass:experimentClass,attached:true,commingFrom:commingFrom,commingFromId:commingFromId]) > } > > so nothing to complicated as far as I think. > > can somebody explain me what I'm doing wrong here? I think it's something reall really stupid... > > > thanks, > > g. > > --------------------------------------------------------------------- > To unsubscribe from this list, please visit: > > http://xircles.codehaus.org/manage_email > > > -- ----------------------------------------------------------------- gert wohlgemuth blog: http://berlinguyinca.blogspot.com/ work: http://fiehnlab.ucdavis.edu/staff/wohlgemuth |
| Free Forum Powered by Nabble | Forum Help |