Rectangle 27 3

First off, chmodding everything to 777 is a really bad idea. It means giving every user on the server full access to everything, meaning anyone with access to your webserver can edit or even delete your files. Comparing it with a real-life issue, it would be like like there's a problem with the lock on your car door and you just decide to never lock your door again. It's avoiding the problem rather than fixing it and you shouldn't be surprised if at one day your radio is gone.

That being said, the core of your problem is that your Cake application (or actually the internal PHP function session_start that it is calling) does not have permissions to write the file /tmp/sess_c885be0c60e567d6c6c7571c61601f71, which is the PHP session file. By default, most PHP installations try to write their session to the /tmp folder on the server. In this case, that doesn't seem to work.

These are a few of the solutions that are possible:

If the application is running on a server that's not administered by yourself (e.g. if you have a paid hosting plan and just have FTP access to your own domain folder), contact the person/party that administers the server and ask them to make the /tmp directory writable. They should be able to properly fix this.

In your app/Config/core.php, set a different way to have Cake sessions stored. There are several options available, all explained in the file itself (right here). Using the cake, cache or database option should make sure your sessions can always be properly accessed.

If you administer the web server yourself, you could give PHP sessions their own folder with the proper access rights. This step consists of a few tasks:

  • Create a folder for the sessions, a common path is /var/lib/php/session
apache
www-data
chown apache.apache /var/lib/php/session
  • Set the proper chmod level to the folder, since only the webserver's user/group would need full access, a chmod of 770 will do (chmod 770 /var/lib/php/session)
session.save_path
session.save_path = "/var/lib/php/session"
  • Restart your webserver and you should be good to go!

php - CakePHP: Permission denied (13) - Stack Overflow

php cakephp permissions file-permissions
Rectangle 27 2

function selection_project_phd() { 
    var phds = document.getElementById('EmployeeGuidedProjectPhd').checked; 
    var projs = document.getElementById('EmployeeGuidedProjectProject').checked; 
    var course_name = document.getElementById('EmployeeGuidedProjectCourseName'); 
    if(phds) { course_name.disable=true; return false; } 
    else if(projs !== true ) { course_name.disable=false; return false; } 
    return true;  
}

php - Validation of radio button in cakephp - Stack Overflow

php javascript cakephp cakephp-1.3
Rectangle 27 0

Adding a 'disabled' key in $attributes whose value is an array containing the values of the radios

$attributes = array('legend' =>false, 'default' => '6', disabled=>array('6','24'));

php - CakePHP disable some radio buttons? - Stack Overflow

php cakephp
Rectangle 27 0

As @Juhana mentioned in the comments, it's helpful if you're more specific.

Typically, however, something like this should work:

var $validate = array(
    'radioField' => array(
        'rule' => 'notEmpty'
     )
);
echo $this->Form->input('radioField', array(
    'type' => 'radio', 
    'options' => array('foo', 'bar')
    )
);
echo $this->Form->radio('radioField', array('foo', 'bar'));

But then you must include the following line in order to display the error:

echo $this->Form->error('radioField');

php - CakePHP how validate radio buttons? - Stack Overflow

php cakephp validation
Rectangle 27 0

There is not a way to use the standard label option with a radio button, but it is easy to add in your view without the use of a custom function:

<label>MyLabel</label>
<?php echo $this->Form->radio('...

Well, I meant a consistent and repeatable way to create the label, which will then take a custom function, but this is the information I needed, so thank you.

php - CakePHP 1.3 - Radio label without legend? - Stack Overflow

php forms cakephp radio
Rectangle 27 0

$options = array(
    '0' => 'Male',
    '1' => 'FeMale'
);

$attributes = array(
    'legend' => false,
    'value' => 0
);

echo $this->Form->radio('type', $options, $attributes);

php - CakePHP Radio Buttons - Stack Overflow

php forms cakephp radio-button radio
Rectangle 27 0

You can simply put the image in the options array:

$myOptions          = array();
$myOptions['power'] = $this->Html->image('cake.power.gif');
$myOptions['icon']  = $this->Html->image('cake.icon.png');

echo $this->Form->input('db.field', array('type' => 'radio', 'options' => $myOptions,  'label' => 'myLabel')); ?>

and where to put the values ?

@endo.anaconda The values are the keys of the $myOptions array

php - adding images next to radio buttons in cakephp - Stack Overflow

php cakephp radio-button radio
Rectangle 27 0

function selection_project_phd() { 
    var phds = document.getElementById('EmployeeGuidedProjectPhd').checked; 
    var projs = document.getElementById('EmployeeGuidedProjectProject').checked; 
    var course_name = document.getElementById('EmployeeGuidedProjectCourseName'); 
    if(phds) { course_name.disable=true; return false; } 
    else if(projs !== true ) { course_name.disable=false; return false; } 
    return true;  
}

php - Validation of radio button in cakephp - Stack Overflow

php javascript cakephp cakephp-1.3
Rectangle 27 0

You need to set the 'legend' option to false if you don't want to show it, or to a string if you want to customize the message:

echo $this->Form->input('option_id', array(
    'options' => $allAmazonMatches,
    'type' => 'radio',
    'legend' => false
));

worked like a charm. Thanks

php - Why is CakePHP Form helper grouping my form radio options? - Sta...

php cakephp cakephp-1.3 cakephp-2.0
Rectangle 27 0

You can do that with the FormHelper class.

<?php

$options = array(
  1 => 'B002I0HJZO',
  2 => 'B002I0HJzz',
  3 => 'B002I0HJccccccccc',
);

echo $this->Form->input('option_id', array('options' => $options, 'type' => 'radio'));

The key is to specify the "type". CakePHP usually defaults to a select element by default.

The example above doesn't use the "automagic" feature of CakePHP. If you retrieve the options in your controller using a find('list') and the array is passed to the view in the plural form of the field name without the "_id" suffix (e.g. if the field is "option_id", you should do $this->set('options', $this->Option->find('list'); assuming that "Option" is the model name), then you shouldn't need to specify the "options", just the "type"

To answer the second part of your question, to post to a different action (e.g. "test"), you need to specify the action when creating the form.

<?php

$this->Form->create('Product', array('action' => 'test'));

php - How do I display a form using CakePHP that has radio buttons? - ...

php cakephp cakephp-1.3 cakephp-2.0
Rectangle 27 0

For certain input types (checkboxes, radios) a hidden input is created so that the key in $this->request->data will exist even without a value specified.

If you want to create multiple blocks of inputs on a form that are all grouped together, you should use this parameter on all inputs except the first. If the hidden input is on the page in multiple places, only the last group of inputs values will be saved. (Documentation)

Thus, for your task, pass 'hiddenField' => false, as an option to all calls to input() for that group's radio button (or checkbox) except the first one. In this example, we have it by the name 'field'.

echo $this->Form->input('field', array(
    'type' => 'radio',
    'options' => array(1 => 'Option A',),
    'class' => 'testClass',
    'selected' => $selected,
    'before' => '<div class="testOuterClass">',
    'after' => '</div>',
    'hiddenField' => false, // added for non-first elements
));

php - CakePHP FormHelper radio buttons (or checkboxes) only last butto...

php checkbox radio-button cakephp-2.0 formhelper
Rectangle 27 0

So I had a similar problem with a questionnaire, where it would be somewhat semantically correct for radio buttons to remain empty - when a yes or no question remains unanswered. In this case it doesn't seem right like this:

'options'=>array(1 => 'No', 2 => 'Yes')

Right, but I want Cake to store this value as a boolean, not as some other value that I would have to manually translate back and forth to boolean.

php - CakePHP Unfilled radio button changed to an unwanted value on su...

php validation forms cakephp
Rectangle 27 0

'label' => array(
        'class' => 'thingy',
        'text' => 'The User Alias'
    )
class="thingy" text="The User Alias"
for="testTestOptionsOption1"

php - cakephp generates wrong label for radio input id - Stack Overflo...

php html cakephp radio-button
Rectangle 27 0

echo $this->Form->input('Lotesimagem.nome', array(
       'options' => array(1=>'Male', 0=>'Female')
 ));

If somehow you want to update those fields as the radio button you must use AJAX to do it, or you can create form with the radio buttons as its input and submit it for updates in database. You can then debug in your controller to see if the radio buttons are connected to the values you have chosen in the form.

php - Cakephp, Interrelated radio buttons? - Stack Overflow

php ajax cakephp radio-button
Rectangle 27 0

You can pass an options attribute to the form helper.

<?=$this->Form->input('rating', array('type' => 'radio', 'options' => range(1, 10)))?>

Gotcha cheers. Was passing the options and html attributes in the wrong order. Thanks again.

php - CakePHP Radio Buttons - Stack Overflow

php forms cakephp radio-button radio
Rectangle 27 0

I may be a bit late to the show, but I came across this issue in upgrading a site to cakephp 2.x. I found if I use the "'hiddenField' => false" option, I was able the separate the radio buttons and put text or select inputs between them:

php - How to markup CakePHP Form to allow Text inputs inside a radio g...

php forms cakephp radio
Rectangle 27 0

This isn't possible unless you call the radio function for each option separately and add 'disabled' => 'disabled' to the $attributes array for the ones you wish to disable. Here's a possible solution:

// Options
$options = array('24' => '24 months','12' => '12 months', '6' => '6 months');

// Disabled options
$disabled_options = array('12');

// Default attributes (these may need to be adjusted)
$attributes = array('legend' => false, 'default' => '6');

// Loop through all of the options
foreach ( $options as $key => $value )
{
  // Output the radio button.
  // The field name is now "period.n" which will result in "data[Model][period][n]" where "n" is the number of months.
  // The options is an array contain only the current $key and $value.
  // The 'disabled' => 'disabled' is added to the attributes if the key is found in the $disabled_options array. 
  echo $this->McForm->radio('period.' . $key, array($key => $value), ( in_array($key, $disabled_options) ? $attributes + array('disabled' => 'disabled') : $attributes ));
}

Whoever first designed the page relied to much on javascript, so it might not hurt. Thanks for the help!

php - CakePHP disable some radio buttons? - Stack Overflow

php cakephp
Rectangle 27 0

$this->Form->input

Creates one input field with the id provided. You'll have to create multiple inputs inorder to make your checkboxes work separately. There could be better methods, but doing it something likethis will work.

foreach($allAmazonMatches as $amazonMatch)
{
  $this->Form->input...
}

php - Why is CakePHP Form helper grouping my form radio options? - Sta...

php cakephp cakephp-1.3 cakephp-2.0
Rectangle 27 0

Edit: ok, I don't think Cake automatically fill that value with 0, most likely it's a browser behavior. You can test that by debug($this->data) when the saving fails. (Just in case it does, you can unset that value there)

I don't want a checkbox, because checkboxes are, by default, on or off, depending on the HTML attributes set. I want the user to be forced to select "yes" or "no", and not have a default submitted if they gloss over the option.

php - CakePHP Unfilled radio button changed to an unwanted value on su...

php validation forms cakephp
Rectangle 27 0

I don't know why you are trying to add radio button in view page it is looking odd.However it is possible.You can try by this line.

<td><input type="radio"><?php echo $l['Lotesimagem']['destaque']; ?></td>

php - Cakephp, Interrelated radio buttons? - Stack Overflow

php ajax cakephp radio-button