Welcome Guest, Not a member yet? Register   Sign In
HMVC url help
#1

[eluser]breaddes[/eluser]
I've built a newsletter module which is structured as follows:

Controller
application/modules/newsletter/controllers/addmember.php

Views
application/modules/newsletter/views/form.php
application/modules/newsletter/views/confirm.php

The controller addmembers has methods to load the form view, to validate input and to load the confirm view. As default it is showing the form view.

That's all all what the module is about. The module can be added to any view of my actual site. My site is structured as follows:

Controller
application/controllers/homesite.php

Views
application/views/homesite.php

If I echo modules::run('newsletter/addmember/form') the default module state is displayed within my homesite view.

Now the problem is that I have to send my form to newsletter/addmember/validate. That's simply because there's the method to validate my form-data. Without ajax this would simply load a fragment without it's outer site context (I mean html-output).

Therefore I would have to load the homesite instead which would make no sense. Although it reloads the same page my module doesn't know that the form has been sent.

How can I deal with that problem?
#2

[eluser]breaddes[/eluser]
What I found out so far is that i simply don't care about the form url. I just write:

Code:
<form action="" method="post">

This obviously loads the same Controller. In my addmember Module Controller I can check now if there has been a $_POST. If there has been one I call the method validate and do whatever there is needed to be done.

This is one way to get around that problem but it's not a great solution. I actually want to able to call the method validate directly without asking if there has been a $_POST sent.

Any idea? Any comment? I would be most glad.




Theme © iAndrew 2016 - Forum software by © MyBB