1
votes

Seems like a simple thing, but I'm having a hell of time doing it.

I'm sure it's a quick fix... any help would be appreciated.

Here's the code:

<!-- apps/frontend/modules/job/templates/_form.php -->
<?php use_stylesheets_for_form($form) ?>
<?php use_javascripts_for_form($form) ?>

<?php echo form_tag_for($form, '@job') ?>
  <table id="job_form">
    <tfoot>
      <tr>
        <td colspan="2">
          <input type="submit" value="Preview your job" />
        </td>
      </tr>
    </tfoot>
    <tbody>
      <?php echo $form ?>
    </tbody>
  </table>
</form>

Yes, this is straight from the JObeet tutorial... found here: http://www.symfony-project.org/jobeet/1_4/Propel/en/10

With all the helpers, I thought this may be a symfony issue. Apparently not? At any rate, there is no action attributed to this post input method, so I can't use link_to or url_for helpers.

1
Can you please show the corresponding code in your template. To answer your question correctly, you need to know how you create your submit input button.domi27
Nothing to do with symfony....Flukey
So instead of having a button (ie <input type="submit">) you want a link (ie <a href=blah blah>) ?Manse

1 Answers

2
votes

Firstly update your form_tag_for function call to include some attributes and give the form an id :

<?php echo form_tag_for($form, '@job', array('id' => 'the_form')) ?>

Then replace your submit button with something like this :

<a href="javascript:{}" onclick="document.getElementById('the_form').submit(); return false;">Submit</a>

As @domi27 suggested - The symfony way - ie using helpers is the following :

<?php echo link_to_function('Submit', "document.getElementById('the_form').submit()") ?>