Welcome, Guest
Username: Password: Remember me

TOPIC: Dropdown in Form

Dropdown in Form 30 Oct 2012 07:56 #4848

  • jcbenton
  • jcbenton's Avatar
  • Offline
  • Premium Member
  • Posts: 125
  • Thank you received: 9
  • Karma: 3
Is it possible to add a dropdown to the form in Cook? for example, I have an Integer field. Instead of a text box I want to add a dropdown with integers assigned as the values.

Example:
<select>
  <option value="1">Option 1</option>
  <option value="2">Option 2</option>
</select>

Instead of this:
<input type="text" name="Option">

See the Server field in the screenshot.

--
Jerry Benton
Last Edit: 30 Oct 2012 07:58 by jcbenton.
The administrator has disabled public write access.

Re: Dropdown in Form 30 Oct 2012 08:36 #4850

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
1 - you could either use an FK field to grab values into a combobox (dropdown) by
  • dragging an Foreign Key field type to your table
  • dragging the table element to the FK field
  • select a field from foreign table, i.e. title to use as label
OR

2 - you could use an enum type field
  • drag enum field type to your table
  • populate the value|label pairs
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.

Re: Dropdown in Form 30 Oct 2012 08:41 #4852

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
Ignore previous post!

Sorry, just coming to life here...jcbenton wrote:
See the Server field in the screenshot.

Can you see some left/right buttons over to the right of your field? Use them to switch to combobox. That should do the trick for you.

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!
The administrator has disabled public write access.

Re: Dropdown in Form 30 Oct 2012 08:53 #4854

  • jcbenton
  • jcbenton's Avatar
  • Offline
  • Premium Member
  • Posts: 125
  • Thank you received: 9
  • Karma: 3
Ok I added another table and made the dropdown. I will try it out in the sandbox. Thanks.
--
Jerry Benton
The administrator has disabled public write access.

Re: Dropdown in Form 01 Nov 2012 11:28 #4889

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
As said @audibleid,

You can use the tiny buttons at the right to change the input aspect (list, combo, radio)
This part of the builder is lacking a little bit (graphical), but it works.
Coding is now a piece of cake
The administrator has disabled public write access.
Time to create page: 0.094 seconds

Get Started