Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Form Questions /

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

Form Action doesn't work


Go to End


6 Posts   5261 Views

Avatar
Vladas

Community Member, 17 Posts

3 June 2010 at 9:24pm

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

Avatar
Vladas

Community Member, 17 Posts

4 June 2010 at 3:01am

Anyone? :)

Avatar
Willr

Forum Moderator, 5523 Posts

4 June 2010 at 12:02pm

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.

Avatar
Vladas

Community Member, 17 Posts

8 June 2010 at 12:00am

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.

Avatar
Vladas

Community Member, 17 Posts

8 June 2010 at 12:20am

Edited: 08/06/2010 12:27am

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 :)

Avatar
Tama

Community Member, 138 Posts

27 September 2010 at 10:37am

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