Hi, I like to know if there was already an option somewhere to lock the # of column. I have a table that has a defined 3 column header, but I would like for my users to be able to add content by inserting rows.

Comments

KristineC’s picture

Or would it be possible to remove it from only the form page?

donpwinston’s picture

I'm trying to do this too. This is how you should be able to do it.

function tw_form_production_node_form_alter(&$form, &$form_state) {
	//see($form);

	$form['field_show_schedule']['und'][0]['tablefield']['rebuild']['#title'] = "Change number of rows";
	$form['field_show_schedule']['und'][0]['tablefield']['rebuild']['count_cols']['#access'] = FALSE;
}

But it does not work. When the user "rebuilds" the table a count_cols index error occurs.

donpwinston’s picture

use hook_form_alter

$form['field_show_schedule']['und'][0]['tablefield']['rebuild']['count_cols']['#prefix'] =
		'<div style="display:none;">';
$form['field_show_schedule']['und'][0]['tablefield']['rebuild']['count_cols']['#suffix'] =
		'</div>';

this appears to work unlike #acesss and #disabled

lolandese’s picture

Issue summary: View changes

Now the field settings define a checkbox Restrict rebuilding to users with the permission "rebuild tablefield". This could be split in:

  • Restrict rebuilding columns to users with the permission "rebuild tablefield columns"
  • Restrict rebuilding rows to users with the permission "rebuild tablefield rows"
lolandese’s picture

Version: 7.x-2.x-dev » 7.x-3.x-dev
liam morland’s picture

Status: Active » Closed (outdated)

Drupal 7 is no longer supported. If this applies to a supported version, please re-open.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.