views:

352

answers:

1

I am attempting to post form data to my app using Facebook. My form is integrated with a dialog and I am using form.submit() to submit the form. Please see my code. The post data does not appear on the backend (e.g. load-cargo-radio, city-id, train-id), but the fb_sig* data does. Does anyone know if there are any caveats regarding posting form data with Facebook? Thanks!

Note: I have tried both using my server domain and my fb callback url for the form action. Neither works.

<div id="action_prompt">
Loading cargo...
</div>
<fb:js_string var="fbjs_load_cargo_select">
  <div id="load_cargo_select">
    <form id="load_cargo_select_form" action="http://railsacrosseurope.com/turn/load_cargo_select" method="POST">
      <p>Your train has stopped in the city of Arhus.</p>
      <p>Arhus produces the following goods:</p>
      <ul>
                  <li>Dairy</li>
              </ul>
      <p>Your train is hauling the following goods:</p>
      <ul>
                  <li>Timber</li>
              </ul>
      <p>What would you like to do?</p>
      <input type="radio" id="load_cargo_radio" value="1">Load new goods</input>&nbsp;&nbsp;
      <input type="radio" id="load_cargo_radio" value="2">Discard existing goods</input>
      <input type="hidden" id="city_id" value="3" />
      <input type="hidden" id="train_id" value="15" />
      <input type="submit" id="submit" value="Submit" />
    </form>
  </div>
</fb:js_string>

.
.
.
<script type="text/javascript">
  var dialog = new Dialog().showChoice('Load Cargo', fbjs_load_cargo_select, 'Okay', 'Pass');
  dialog.onconfirm = function() {
    // Submit the form if it exists, then hide the dialog.
    frm = document.getElementById('load_cargo_select_form');
    if (frm) { frm.submit(); }
    dialog.hide();
  };
  dialog.oncancel = function() {
    form = document.getElementById('redirect_form');
    form.setAction('http://apps.facebook.com/rails_across_europe/turn/move_trains_auto/');
    form.submit();
  }
</script>
[/code]
A: 

The problem was not with Facebook. The problem was that I left out the "name" attribute for my input elements.

Chris Barnhill