1794 Posts in 590 Topics by 562 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 915 Views |
-
(solved) Show data after submitting a form

17 March 2011 at 12:32am Last edited: 17 March 2011 12:32am
Hello,
I think I have an easy problem. My current form looks like this:
Depending on the chosen Dropdown item I want to show the user different data. My code looks like this:
public $SkriptanmeldungenAll;
function doSubmitDruckliste($data, $form) {
//some code
$this->SkriptanmeldungenAll = DataObject::get("Skriptanmeldung","SkriptID = '$SkriptID'");
//...
}function GetSkriptanmeldungen()
{
return $this->SkriptanmeldungenAll;
}An the template looks like this:
...
<% control GetSkriptanmeldungen %>
<tr style='height:30px' >
<td>$Nachname</td>
<td>$Vorname</td>
<td></td>
</tr>
<% end_control %>But if I try to use the button "Anzeigen" no data were shown, because the variable $this->SkriptanmeldungenAll is empty.
What can I do to display the data?I also tried this way:
function GetSkriptanmeldungen()
{
if($_POST['SkriptID'])
{ // return the data }
}
But I think the $_POST - Variable isn't be setted.Can anyone help me?
Best regards, Beppo
-
Re: (solved) Show data after submitting a form

23 March 2011 at 5:19am Last edited: 23 March 2011 5:19am
No ideas how I can solve my problem?
Best regards, Beppo
-
Re: (solved) Show data after submitting a form

23 March 2011 at 6:00am
When you are sure the form data is valid, you can save the ID in a session.
Session::set('SkriptID',(int)$data['SkriptID']);
Session::get('SkriptID');If you're looking for a cookieless option, you can also use GET parameters via controller.
http://doc.silverstripe.org/sapphire/en/topics/controllerOr if a login to your service is required, you can also save the ScriptID & Member::currentUserID() in a DataObject.
-
Re: (solved) Show data after submitting a form

29 March 2011 at 7:40am
Thank you very much, now it works
Best regards, Beppo
| 915 Views | ||
|
Page:
1
|
Go to Top |


