Jump to:

5513 Posts in 1732 Topics by 1218 members

Customising the CMS

SilverStripe Forums » Customising the CMS » dropdown list in contect us form

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

Page: 1
Go to End
Author Topic: 1768 Views
  • amarbhanu
    Avatar
    Community Member
    57 Posts

    dropdown list in contect us form Link to this post

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

  • Willr
    Avatar
    Forum Moderator
    5482 Posts

    Re: dropdown list in contect us form Link to this post

    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

  • amarbhanu
    Avatar
    Community Member
    57 Posts

    Re: dropdown list in contect us form Link to this post

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

  • amarbhanu
    Avatar
    Community Member
    57 Posts

    Re: dropdown list in contect us form Link to this post

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

  • secuaz
    Avatar
    Community Member
    21 Posts

    Re: dropdown list in contect us form Link to this post

    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.

  • Willr
    Avatar
    Forum Moderator
    5482 Posts

    Re: dropdown list in contect us form Link to this post

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

  • secuaz
    Avatar
    Community Member
    21 Posts

    Re: dropdown list in contect us form Link to this post

    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!!!!

    1768 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.