1779 Posts in 582 Topics by 556 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 726 Views |
-
Data validation problem in form

6 March 2010 at 12:36pm Last edited: 6 March 2010 12:48pm
Hello!
I and my programmer have problem with form on SilverStripe.
We've got as follows:
Select: Chose country*
Select: Chose year*
Field: Name*
Field: Phone**
Field: Mobile Phone**
Field: Email***[SEND >]
* field is required
** only one number is required, so user can put either phone number or mobile, this field has custom formating so when user fill number like 123456789 it automatically fills like this 123-456-789
*** email is not requiredWe've disabled custom validation in JavaScript.
In Page.php we've got function in controller which creates form SideBarForm() which has action on SendSidebarForm().
Some fields in our form are dynamically generated and managed with JavaScript, so after user filled incorrect values in form, after clicking [send>], page is reloading and the wrong entered fields are marked red, unfortunately even if data was ok or wrong, we have blank fields again.In SendSidebarForm function values from $data are saved to session from which another function (eg. GetName) reads it and sends it to theme
function GetName() {
   if(Session::get("SideBar-Name")) {
       $value = Session::get("SideBar-Name");
       return $value;
   } else
       return "";
It works but only when form is filled correctly. So we think that this function works only when correct data is filled.We've also tried to reach this values by $_REQUEST i $_POST and writing them into session (e.g. functions Sidebar, init(), __construct, GetName, etc) but no luck.
Can we have this data saved in additional session, when form was filled with incorrect values?
| 726 Views | ||
|
Page:
1
|
Go to Top |

