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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Form Questions /

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

Validation requires page refresh?

Go to End



Community Member, 130 Posts

10 August 2010 at 9:16am

Edited: 10/08/2010 1:08pm

I'm trying to validate a form that is inside a modal window, but on submit the page refreshes.

basically the problem goes like this:
1. user mouses over event trigger, the form shows in a modal window.
2. user fills in the form and clicks submit.
3. page refreshes and modal window is now gone.

obviously i'd prefer to not have the modal window disappear, which means i'd rather not have a page refresh. BUT if that's the only way possible i can live with that. however, when the page refreshes and there *is* an error, the error is shown just before page refresh and when the refresh is finished and a user mouses back over the modal form it displays with a single dot instead of the error message.

see attached.

it should be noted that i'm also using the jquery library for other javascript goodness. is my only option to use the jquery.validate library?

any help is appreciated.


EDIT: These are my form functions that are inside my Page.php Controller, The $Form is being called from my

// Form for the email signup
	function Form() {
		$fields = new Fieldset(new Textfield ('ConnectBoxEmail', 'Email'));
		$actions = new Fieldset(new ImageFormAction('doSubmitConnect','','themes/mytheme/images/newsletterSignup.gif','','',''));
		$validator = new RequiredFields('ConnectBoxEmail');
		$form = new Form($this,'Form',$fields,$actions,$validator);
		return $form;

// Form processor for email signups
	function doSubmitConnect($data, $form) {
		$connect = new EmailCollect();
		$form->sessionMessage('Form successfully submitted','good');