In my controller I simply forwarded to the mighty template like
def mightyTestAction(self):
print m.request_args
m.subexec('/index.myt')
And in the index.myt I set the form action to:
<% h.url_for(action='mightyTestAction') %>
my routing.py has only the default:
map.connect(':controller/:action/:id)
The problem:
The index page shows up, but after filling in the fields and submitting
the form, the form args are not shown in the following page and the
field values are not preserved either. Somehow the request arguments
get lost on the way from the controller to the template renderer,
because inside the controller the print statement prints the args all
fine.
The application should work as on the mighty homepage:
http://www.myghty.org/examples/formcontrols/index.myt
I am still running
Mighty 1.0
pylons 0.8dev_r463
any help is appreciated
thanks,
Alex.
> The index page shows up, but after filling in the fields and
> submitting
> the form, the form args are not shown in the following page and the
> field values are not preserved either. Somehow the request arguments
> get lost on the way from the controller to the template renderer,
> because inside the controller the print statement prints the args all
> fine.
>
> The application should work as on the mighty homepage:
> http://www.myghty.org/examples/formcontrols/index.myt
>
> I am still running
> Mighty 1.0
> pylons 0.8dev_r463
Is this problem still occurring now that you've updated? Sorry bout
the late reply, didn't see this email go by earlier.
- Ben
can anybody please verify the problem? I am currently stuck with this
problem. And I can find no samples with pylons and mighty form
controls.
The three mighty files can get from
http://www.myghty.org/source/htdocs/examples/formcontrols/index
thanks,
Alex.
Perhaps I missed a message or two but what exactly are you trying to
accomplish?
Uwe.
>thanks,
>Alex.
>
>
So I have problems to show form input contents on the following page.
Alex.
I want to use a html form with some input fields. If certain fields are not filled properly then the same page should be returned with the fields prefilled. So I have problems to show form input contents on the following page.
my structure is slightly different, I hav all myt files in templates:
/templates
field.myt
components.myt
index.myt
/controllers
mightytest.py
the controller looks like:
from fotobuchxxl.lib.base import *
class MightytestController(BaseController):
def mightyTestAction(self):
print m.request_args
m.subexec('/index.myt')
ALex.
validation would be the next step. I only want to see that the input
data (key, value pairs) can be show on the following page.
my structure is slightly different, I hav all myt files in templates:
/templates
field.myt
components.myt
index.myt
mightytest.py
the controller looks like:
from fotobuchxxl.lib.base import *
class MightytestController(BaseController):
def mightyTestAction(self):
print m.request_args
m.subexec('/index.myt')
If the form post action="index.myt" I don't think it will come back to
your controller. If it is coming back and m.request_args is returning
what you want then you might like to try passing the return values from
m.request_args as arguments to m.subexec.Is this the suggested way to do it in pylons?
thanks, the following works:
def mightyTestAction(self):
print m.request_args
m.subexec('/index.myt', **m.request_args )
Is this the suggested way to do it in pylons?
> thanks, the following works:
> def mightyTestAction(self):
> print m.request_args
> m.subexec('/index.myt', **m.request_args )
>
> Is this the suggested way to do it in pylons?
Yes, I was helping someone on the irc channel out with the same thing
last night. The reason the examples for Myghty don't work when taking
<%args> blocks is because the Myghty examples do not have controllers
in the middle. The Myghty examples have the request go directly to
the template, when you instead call a template from a controller,
those arguments are not passed in unless you specify them.
Usually, I process the arguments as necessary in the controller,
assign the variables I want to use to 'c', then use them in the
templates as desired. If you just want to pass the request through to
the template with all its arguments intact, that is the suggested way.
HTH,
Ben