Jump to:

2011 Posts in 1436 Topics by 620 members

Form Questions

SilverStripe Forums » Form Questions » Passing ID into Form Issues

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1257 Views
  • rbquirke
    Community Member
    70 Posts

    Passing ID into Form Issues Link to this post

    Hi folks

    I have a form on the front end which is used to edit dataobjects, so what I am doing is passing in the ID to the url of the form: edit-account/edit/$ID

    So the $ID is passed in to the form and it is loaded with the correct values - this all works fine.

    When I go to save the form, the page is blank with no markup whatsover (site is in dev mode), and this is the url: edit-account/Form

    Both form and save form functions are contained in my page_controller class.

    Now, when I take out the $ID in the url and hard code this value into the form, I can edit my dataobject no problem - it saves fine.

    So it seems that have the $ID at the end of the page that calls the form is what is breaking it.

    Anyone have any ideas?


  • JimAasheim
    Community Member
    12 Posts

    Re: Passing ID into Form Issues Link to this post


    I had the same problem.

    What does your form code look like?
    It also needs to return the form object after you submitted the form (just make sure it's not filled again with the old values from the database).
    After the form function SS calls the "action function", i.e. the function the save button calls.

    So what I did was, make sure the form function returns a valid form after the button click.
    Then in the doSave - or whatever you called it - implement the necessary code.

    Hope this could help - or post your code and I'll have a look at it.

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.