Computer Help and Spyware Removal Computer Help and Spyware Removal Computer Help and Spyware Removal Computer Help Forums Windows Startup Programs Database Virus, Spyware, and Malware Removal Guides Computer Tutorials Uninstall Database File Database Computer Glossary Computer Resources
 

Welcome Guest ( Log In | Click here to Register a free account now! )



Register a free account to unlock additional features at BleepingComputer.com
Welcome to Bleeping Computer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.
Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

 
Reply to this topicStart new topic
> setting values for a hidden input field in a form, Symfony 1.2 forms
petocities
post May 13 2009, 01:43 PM
Post #1


Member
**

Group: Members
Posts: 94
Joined: 3-June 06
From: Santiago Chile
Member No.: 70,596



Hello everyone,

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>

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: ?>


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());
      }


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


--------------------
IPB Image
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 21st November 2009 - 07:57 PM


Advertise   |   About Us   |   Terms of Use   |   Privacy Policy   |   Contact Us   |   Site Map   |   Chat   |   Tutorials   |   Uninstall List
Discussion Forums   |   The Computer Glossary   |   Resources   |   RSS Feeds   |   Startups   |   The File Database   |   Virus Removal Guides

© 2003-2009 All Rights Reserved Bleeping Computer LLC.