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.

Customising the CMS /

dropdown list in contect us form


Reply


7 Posts   1888 Views

Avatar
amarbhanu

Community Member, 57 Posts

15 June 2009 at 11:38pm

how to show in dropdown list in contect us form..........

Avatar
Willr

Forum Moderator, 5513 Posts

16 June 2009 at 5:28pm

Is you contact form a UserDefinedForm or a Standard PHP form?

The dropdownfield docs is available at http://doc.silverstripe.com/doku.php?id=dropdownfield

Avatar
amarbhanu

Community Member, 57 Posts

17 June 2009 at 2:13am

thanks sir please give me answer this question :http://www.silverstripe.org/widgets-2/show/262562?showPost=262562

Avatar
amarbhanu

Community Member, 57 Posts

20 June 2009 at 2:21am

Edited: 20/06/2009 2:22am

multiple record insert by admin and by menu want to display on site this multiple record so, please help me...., how to possible.........

Avatar
secuaz

Community Member, 21 Posts

13 May 2013 at 9:10pm

Edited: 13/05/2013 9:15pm

Hi all! I got to make a dropdown in my contact form in SS 2.4
Since I am emailing the info from the form, In the email template im getting the ID of the dropdown object instead of its value.

This is the code..

in function ContactForm
   
$locations = DataObject::get('LocationPage');
if ($locations) {
$locations = $locations->toDropdownMap('ID', 'Title', '(Select one)', true);
}

    $fields = new FieldSet(
new DropdownField('LocationID', 'Location', $locations) ------> According to the tutorial I need to use Location ID, but then how do I get the Title to show in the template???

      );

Then in the template I use $LocationID and it returns the ID of the location. If I use $Location or similar names nothing will show up or the email will not be sent.
How can I display the selected location Title in the template?

Thank you.

Avatar
Willr

Forum Moderator, 5513 Posts

15 May 2013 at 8:04pm

Have you setup your $has_one = array('Location' =>'LocationPage');

Avatar
secuaz

Community Member, 21 Posts

15 May 2013 at 9:13pm

I got it!!!

Just had to make this change:

$locations = $locations->toDropdownMap('ID', 'Title', '(Select one)', true);
INTO
$locations = $locations->toDropdownMap('Title', 'Title', '(Select one)', true);

thank you!!!!