I have a module called main which is my default module and a module called song.
I want to put into my main module an “add form” of my song module.
I don’t know if I have to use component, how and where to process the form.
Could you please help me ?
Have you checked the documentation? Specially this part of the doc?
It covers the form system by using a basic contact form:
actions.class.phpinside yourmainmodule) which create an instance of the form and handle the submission (validation, save, etc ..)contactSuccess.php), which display the formThe main difference is that you probably have a model called Song, so you will have to use the SongForm instead of creating a new one (using
new sfForm()). For this part, you can see, on the same documentation page, the part Forms Based on a Model which cover the case of an article model.Edit:
A step by step:
In your
main/actions/actions.class.php:In your template,
main/templates/indexSuccess.php:And you’re done.
I really encourage you to read the whole Jobeet tutorial. You will learn lots of things. Basically every thing I described here, is in this tutorial.
For the
sf_guard_userfield, you should redefine it as hidden, and then set a default value with the current connected user.Create a new form:
/lib/form/CustomSongForm.class.phpThen you can define the default, like you said: