Hi,

Luc thanks for your fast reply!. OK as i understand i do not need to
embed forms, because i do not need to "... input of data (edition or
adding new data) into multiple related objects.". What i need to do is
much simpler(i think) than that:

**Just think,  for example, that i want to create a "todo" site, so
everytime the user clicks over the "add another" link the app will
render a new textbox that will be part of the "todoForm", so you can
click the "add" link as many times you wish to create any amount of
todo's(new textboxes ), and then submit the form and save them.**

So back to my problem, I have created one form called "stepOneForm" in
wich i have created 2 widgets( and validators form them too ) as
follows:

class StepOneForm extends BaseForm
{
    public function configure() {
            $this->setWidgets(array(
                'txt_check_in'          => ....,
                'txt_check_out'        => ....,
            ));

            $this->setValidators(array(
                'txt_check_in'          => ...,
                'txt_check_out'        => ...,
    } // end configure
}

Then i have created a module called "reserve" wich has a template
called "StepOneSuccess"(and it's related action called
"executeStepOne"), that renders the widgets of the "StepOneForm" as
follows:

<form id="stepOneForm" action="<?php echo url_for('reserve/stepOne')?
>" method="post">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
        <td>
                 <?php echo $form['txt_check_in']->renderError() ?>
                 <?php echo $form['txt_check_in']->render() ?>
            </td>
            <td>
                 <?php echo $form['txt_check_out']->renderError() ?>
                 <?php echo $form['txt_check_out']->render() ?>
            </td>
        </tr>
    <tr>
        <td>
            <a href="#" id="addRoom">+Add another room</a>
        </td>
    </tr>
</table>
<?php echo $form['_csrf_token']->renderError() ?>
<?php echo $form['_csrf_token']; ?>
</form>

Now, the above template and form("StepOneForm") does not have all the
inputs that i need to complete the process, i still need to add
"rooms", so the user can select a checkin-checkout date and then add
rooms as he/she needs to reserve. For this i have created the "add"
link, so everytime the user clicks on it, it fires an AJAX javascript
method that asks the server to create the widgets needed for entry the
room data (Note, this "room data" is not another form, they are just
widgets like  "adult quantity" input, "children quantity" input and
"bed type" input, that i need to add to "steOneForm" dynamically when
the user clicks the "add" link)...

And here is my problem:

a) Do i need to embedForm? (the link you gave me used embedform..but i
am not sure if i need to use this)
b) How can i add dynamically new widgets to the "stepOneForm" when the
user clicks over the "add" link
c) How can i render this new widgets dynamically created into the
template

any idea?

Cheers,

Shirkavand

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to