Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8559895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:09:30+00:00 2026-06-11T16:09:30+00:00

This is the dropdown code iam used: $task_id = 2; $inr = 0; $arr

  • 0

This is the dropdown code iam used:

$task_id = 2;
    $inr = 0;
                        $arr = array();
                        foreach ($options as $option){
                            $inr = $option['Employee']['employee_id'];
                            $arr[$inr] = $option['Employee']['first_name'].' '.$option['Employee']['last_name'];
                        }
                        echo $this->Form->input('assigned_to',      array(  'options' => array( $arr), 
                                                                    'empty' => '(choose one)',
                                                                    'div'=>'formfield',
                                                                    'label' => 'Assigned To',
                                                                    'error' => array(   'wrap' => 'div',
                                                                                        'class' => 'formerror'
                                                                                    )
                                                            ));

Its displayed with correct values in the $options.

But i need to select one option value usinsg cakephp code.

How can i do this?

That is i have a variable with value as :

$task_id = 2;

So how can i put selection to this option value?

If it is possible ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T16:09:31+00:00Added an answer on June 11, 2026 at 4:09 pm

    you mean default value?
    either use default key in the attributes for your form input element or the cleaner approach using the controller:

    /* inside add/edit actions */
    if (!empty($this->request->data)) {
        $this->Country->create();
        if ($this->Country->save($this->data)) {
            ...
        } else {
            ...
        }
    } else {
        /* Now here you can put your default values */
        $this->request->data['Country']['active'] = 1;
        $this->request->data['Country']['lat'] = 0.0;
        ...
    }
    

    @see http://www.dereuromark.de/2010/06/23/working-with-forms/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this HTML code which simulates a dropdown multi-checkbox <div> <div class=select> <span>Select
I have a dropdown.Basing on this dropdown i shud load another dropdown.i wrote code
This is my code for a drop down menu. I pulled the code from
I have this code which can display drop down in div tag of html.
I have this dropdown. I need clone for my other dropdown lists: <select name=general>
So I'm trying to adapt this Dropdown menu on Joomla the styles work great
I am using the Bootstrap CSS framework that has this: .dropdown-menu { left: 0;
I have a dropdown list. I am using onchange event of this dropdown to
I have this HTML dropdown: <form> <input type=text id=realtxt onkeyup=searchSel()> <select id=select name=basic-combo size=1>
I'm using this Dynamic Drive dropdown menu ( http://www.dynamicdrive.com/dynamicindex1/chrome/ ---- js source at http://www.dynamicdrive.com/dynamicindex1/chrome/chromejs/chrome.js

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.