title: Building a Joomla 3 Custom Component
body: <p>I am currently building a custom Component in Joomla 3 that allows users to search for a sports club by postcode using an Ajax form on the front end. 
  I have all this functionality working and am now currently working on the backend of the component (in the admin). This section needs to alow admins to add and delete sports clubs amongst other things.</p>
  
  <p>I am not overly experienced with building custom Joomla components but have a good working knowledge of MVC but have encountered some issues.</p>
  
  <p>The component uses a view called 'Posctodes' as the default view which itself contains a dropdown menu of all the current sports clubs which allows a user to choose a club, hit submit and be taken to an edit page to change details about that club. This is where I am having the problem.
  I want to make a seperate view called 'editform' which a user would be taken to they have chosen a club to edit. I am unsure as to how to go about this within the Joomla framework.</p>
  
  <p>Here is my code for the component so far:</p>
  
  <p>Controller ofr the component (admin/components/com_postcode/controller.php):</p>
  
  <pre><code>&lt;?php
  defined('_JEXEC') or die;
  
  class PostcodeController extends JControllerLegacy {
  
      protected $default_view = 'postcodes';
  
      public function display($cacheable = false) {           
  
          $view = $this-&gt;input-&gt;get('view', 'postcodes');
          $layout= $this-&gt;input-&gt;get('layout', 'postcodes');
          $id     = $this-&gt;input-&gt;getInt('id');
  
          return parent::display($cacheable);
      }
  }
  </code></pre>
  
  <p>?></p>
  
  <p>The view.html.php file for the postcode view (admin/components/com_postcode/views/postcodes/view.html.php):</p>
  
  <pre><code>&lt;?php
  defined('_JEXEC') or die;
  
  class PostcodeViewPostcodes extends JViewLegacy {
  
      public function display($tpl = null) {
          $clubs = $this-&gt;get('Clubs');
          $this-&gt;clubs = array();
          foreach($clubs as $club) {
              $this-&gt;clubs[] = array(
                  'club_id'         =&gt;    $club['club_id'],
                  'name'            =&gt;    $club['name'],
                  'postcode'        =&gt;    $club['postcode'],
                  'link'            =&gt;    $club['link'],
                  'description'     =&gt;    $club['club_id'],
                  'image'           =&gt;    $club['club_id'],
                  'address'         =&gt;    $club['club_id']
              );
          }
          $pagination = $this-&gt;get('Pagination');
  
          $this-&gt;items = $items;
          $this-&gt;pagination = $pagination;
  
          parent::display($tpl);
      }
  
  }   
  </code></pre>
  
  <p>?></p>
  
  <p>And the view file (admin/components/com_postcode/views/postcodes/tmpl/default.php):</p>
  
  <pre><code>&lt;div class="row-fluid"&gt;
  &lt;div id="filter-bar" class="btn-toolbar"&gt;
      &lt;a class="btn" href=""&gt;Clubs&lt;/a&gt;
      &lt;a class="btn" href=""&gt;Postcodes&lt;/a&gt;
  &lt;/div&gt;
  &lt;div class="span2"&gt;view
  
  &lt;/div&gt;
  &lt;div class="postcode_admin span10"&gt;
      &lt;h3&gt;Postcode Search Component&lt;/h3&gt;      
      &lt;form action="&lt;?php echo JRoute::_('index.php?option=com_users&amp;view=clubedit');?&gt;" method="post" name="postcodeForm" id="postcodeForm"&gt;
          &lt;select name="clubs" id="clubFilter"&gt;
              &lt;option value=""&gt;-- Please select --&lt;/option&gt;
              &lt;?php foreach($this-&gt;clubs as $club) { ?&gt;
                  &lt;option value="&lt;?php echo $club['club_id']; ?&gt;"&gt;&lt;?php echo $club['name']; ?&gt;&lt;/option&gt;
              &lt;?php } ?&gt;
          &lt;/select&gt;
          &lt;input type="submit" name="submit" id="submit" value="Submit" /&gt;
      &lt;/form&gt; 
  
      &lt;div class="club_information"&gt;
  
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>As you can see from the 'default.php' file I am telling the form to submit to the 'clubedit
  ' view but it doesn't. I know I am missing something here but there is not a lot of documentation on Joomla 3 components online. Can anyone shed any light on this?</p>
  
  <p>Thanks!!</p>