I'm currently working with the symfony 1.2 framework, and I've found it to be most difficult. I don't consider myself a begginer in programming, but I just can't find a way around this framework, heh. the symfony+HTML combo is giving me major headaches!
The problem I cannot solve is that I want to pass a parameter to a hidden input field in a form. The context is as follows:
- There is a form that a certified user has to fill. Specifcly, the admin has to add a user to an organization through this form.
- If the user he wants does not exist, he has to create it first, then add him to the said org.
the path is something like this:
First, from here I redirect to create the new user, given that the one the admin wants does not exist:
CODE
// from template.php
<ul class="sf_admin_actions">
<li class="sf_admin_action_new"><a href="<?php echo url_for("local_pm/new?newLocal_pm=".$member->getId()) ?>"> <?php echo __('New', array(), 'sf_admin') ?> </a></li>
</ul>
<ul class="sf_admin_actions">
<li class="sf_admin_action_new"><a href="<?php echo url_for("local_pm/new?newLocal_pm=".$member->getId()) ?>"> <?php echo __('New', array(), 'sf_admin') ?> </a></li>
</ul>
What I do, is that I give the ID as a parameter. The same ID i'll be needing next.
Here I want to create the new user, giving him a speific ID to one of his fields:
CODE
if($sf_params->get('newLocal_pm')||$sf_params->has($form->getName().'[newLocal_pm]')):
?>
<h1><?php echo __('Admin local partner', array(), 'messages') ?></h1>
<h3><?php echo __('New partner', array(), 'messages') ?></h3>
[b]<?php $form->setWidget('local_partner_id',new sfWidgetFormInputHidden()) ?>[/b] //<-- here goes the parameter
<?php else: ?>
?>
<h1><?php echo __('Admin local partner', array(), 'messages') ?></h1>
<h3><?php echo __('New partner', array(), 'messages') ?></h3>
[b]<?php $form->setWidget('local_partner_id',new sfWidgetFormInputHidden()) ?>[/b] //<-- here goes the parameter
<?php else: ?>
After that, I just redirect the admin back to the original page so he can continue navigating
CODE
if ($request->hasParameter('_save_and_add'))
{
$this->getUser()->setFlash('notice', $this->getUser()->getFlash('notice').' You can add another one below.');
$this->redirect('@local_partner_member_new');
}
else
{
if($request->hasParameter($form->getName().'[newLocal_pm]'))
$this->redirect('localPartner/10/new?localPartner='.$local_partner_member->getPersonId());
$this->redirect('@local_partner_member_edit?id='.$local_partner_member->getId());
}
{
$this->getUser()->setFlash('notice', $this->getUser()->getFlash('notice').' You can add another one below.');
$this->redirect('@local_partner_member_new');
}
else
{
if($request->hasParameter($form->getName().'[newLocal_pm]'))
$this->redirect('localPartner/10/new?localPartner='.$local_partner_member->getPersonId());
$this->redirect('@local_partner_member_edit?id='.$local_partner_member->getId());
}
I hope this info is enough. If not, I can try to answer whatever questions you ask in order to solve the problem. Also, I hope my issue is not as trivial as my last post, but i'd rather ask foolish questions than be kept by silly issues. Thanks a bunch guys