Jump to:

2012 Posts in 1438 Topics by 621 members

Form Questions

SilverStripe Forums » Form Questions » Form Action doesn't work

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

Page: 1
Go to End
Author Topic: 2430 Views
  • Vladas
    Avatar
    Community Member
    17 Posts

    Form Action doesn't work Link to this post

    Hello,

    I have a problem with my forms. When form is submitted, I can't get my doApply() method be executed. I've tried different approaches in creating my form - subclassing as well, but still no luck. If I add doApply() to $allowed_actions and execute it through URL, it prints me out "Hello" on a blank page. But with form, it prints me out "Page not found". What is a problem here? Is it a bug in SilverStripe? Thank you.

    My JobsPage.php: http://pastebin.com/3dMt8QwX
    My JobsPage.ss: http://pastebin.com/5iiUG4sU

  • Vladas
    Avatar
    Community Member
    17 Posts

    Re: Form Action doesn't work Link to this post

    Anyone?

  • Willr
    Avatar
    Forum Moderator
    5511 Posts

    Re: Form Action doesn't work Link to this post

    Your code looks pretty good, only thing that strikes me you might need to test is remove the showjob function. Perhaps this is causing it issues as when you submit the form it may be calling the ShowJob function as well but without the ID set therefore not returning a form object.

    Try a simplier case (like remove that whole showjobs function) and see if that works.

  • Vladas
    Avatar
    Community Member
    17 Posts

    Re: Form Action doesn't work Link to this post

    Tried to remove it, but still the same thing.

    Actually, I can't remove ShowJob() as I will use this to generate a page where my apply form will be stored for each dataobject.

  • Vladas
    Avatar
    Community Member
    17 Posts

    Re: Form Action doesn't work Link to this post

    Hmm, found out that this is stopping it from working. If I remove it - starts to work

       

    static $allowed_actions = array (
           'ShowJob'
       );

    Problem is - I need to have ShowJob as allowed action as I use it to call out a job entry and there is my form displayed. I also tried adding 'doApply', but also without luck.

    Edit: Weird, just needed to remove it and everything works fine

  • Tama
    Avatar
    Community Member
    130 Posts

    Re: Form Action doesn't work Link to this post

    Hi Vladas

    I'm having a similar problem and am after some clarification for your fix.

    Do you now have an empty $allow_actions statement:

       static $allowed_actions = array(
       );


    or have you removed it altogether from the Page Controller extension?

    Cheers
    Tama

    2430 Views
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.