Welcome, Guest
Username: Password: Remember me

TOPIC: Builder not allowing field selection at all layers

Builder not allowing field selection at all layers 21 Jul 2016 17:36 #14306

  • vlemos
  • vlemos's Avatar
  • Online
  • Elite Member
  • Posts: 295
  • Thank you received: 41
  • Karma: 21
Hello Admin

Recently I attempted to select a linked field in my component; however, the builder created a field for the second layer and not the third level as I requested (see attached).



Can you ask it to play nice? It would be helpful to drag fields from any level as it did in the past.

Warm regards
vlemos
The administrator has disabled public write access.

Builder not allowing field selection at all layers 21 Jul 2016 22:02 #14307

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
This is normal.

What you try to do is a non-sense in a form.
It is not a cook limitation, it is simply not possible by design.
Even if you try to achieve that manually, you cannot, or it is dangerous because you are editing an information reused / shared in other items.

In a Fly it is possible to instance what you want.
Coding is now a piece of cake
The administrator has disabled public write access.
The following user(s) said Thank You: vlemos

Builder not allowing field selection at all layers 21 Jul 2016 22:13 #14308

  • vlemos
  • vlemos's Avatar
  • Online
  • Elite Member
  • Posts: 295
  • Thank you received: 41
  • Karma: 21
I don't need to edit this value here, only display it on the form. When I download the component I will change it from ->input to ->value
The administrator has disabled public write access.

Builder not allowing field selection at all layers 21 Jul 2016 22:21 #14309

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
So, you only have to instance a Fly brick, and drop the value inside.

One great thing with cook is the ability to mix Form and fly on the same layout.
Coding is now a piece of cake
The administrator has disabled public write access.
The following user(s) said Thank You: vlemos

Builder not allowing field selection at all layers 21 Jul 2016 22:27 #14310

  • vlemos
  • vlemos's Avatar
  • Online
  • Elite Member
  • Posts: 295
  • Thank you received: 41
  • Karma: 21
Ok, cool, but I have done it manually already. Thx, v
The administrator has disabled public write access.

Builder not allowing field selection at all layers 21 Jul 2016 23:48 #14311

  • vlemos
  • vlemos's Avatar
  • Online
  • Elite Member
  • Posts: 295
  • Thank you received: 41
  • Karma: 21
BTW: although the fly option is great, it may be nice if cook offered adding these types of selections as "value" or "readonly" instead of always needing the extra coding involved in a fly.

<div class="controls">
	<?php echo $field->value; ?>
</div>
Not every field on a form should be editable. It has always baffled me why the default create and modified by/date fields of a cook form are editable by a user. Maybe someone could share on why this is necessary.
Last Edit: 22 Jul 2016 13:33 by vlemos.
The administrator has disabled public write access.

Builder not allowing field selection at all layers 24 Jul 2016 13:59 #14318

  • MorganL
  • MorganL's Avatar
  • Offline
  • Platinum Member
  • Posts: 438
  • Thank you received: 53
  • Karma: 16
In J-Cook is you use the wizard to add

Created by, Modified by, Created date, Modified date

to your table you don't need to add them in any view form whatsoever, they are automatically pre filled by the system and unless you deliberately intend it (like Joomla articles allow you to change created by for example) then these fields will take care of themselves and shouldnt really be needed in a form brick at any time as they are always 'there' in the background

It would be nice to have a 'readonly' tick box though for fields, though I personally would prefer my readonly fields to be like the bootstrap 3 readonly switch which still retains the field type look but is not editable
Morgan Leecy MCSE

Novell / Linux
PHP. MYSQL, Apache, node.js
Coldfusion, JQuery, HTML5
Joomla
The administrator has disabled public write access.

Builder not allowing field selection at all layers 24 Jul 2016 18:13 #14319

  • vlemos
  • vlemos's Avatar
  • Online
  • Elite Member
  • Posts: 295
  • Thank you received: 41
  • Karma: 21
Personally I edit JDom and all necessary files to ensure that I can add the read-only attribute to the IDs and all audit fields. Can share the necessary changes if anyone needs the additional work.

Currently after selecting a field from a linked table the builder disallows all other selections. My understanding is that in cook, if you need additional fields, you should add a Fly to the page and add the fields there as read-only. This is adequate in some scenarios but not across the board.

I believe that once the user is prompted, all additional fields could just as easily be added as "value" instead of "input". This would allow fields [editable and read-only] to be closely associated on a page and offer greater layout flexibility.

The idea that all the fields on a form must be editable is not exactly a real-world paradigm. However, this may not be a discussion Admin can address at this time.

I don't desire to be confrontational in any way so I will leave it alone for now. I remember 3 – 4 years ago when I first suggested SQL Import; it met with a vehement "no-way will I consider that on my server, discussion permanently closed!" This is why I didn't use the word "import" in my subject when I recently reopened that dialog. Now; however, the need for it is obvious and it has been promised.

The framework already supports what I am suggesting ($field->value;), but sometimes things change as the thinking and technology matures; I'll give it time.

Warm regards
vlemos
The administrator has disabled public write access.

Builder not allowing field selection at all layers 25 Jul 2016 09:37 #14320

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
The Read-only parameter in JDom is a great idea. You can post you proposal in the 'New Functionalities' category, or GitHub.


About the SQL Import, I will reconsider it. Because I can always block some features in the sandbox if they are too dangerous.
And it depends which import do you mean. From the builder to import a project, or from the component to import datas.
To import a SQL structure and create a project, this is deadly easy.
To import a set of datas in your component, it is really more complex to handle and set up all Foreign Keys, but it will be possible in future.

Please post your requests in the 'New functionalities' section of the forum, in separated posts. I prefer 4 differents posts if you propose 4 different ideas.

All your proposals are highly welcome. I refuse very few of them, the only thing can be for security reasons.

About Features Request, I am preparing a dashboard for the users to vote for their preferred features.
Next Monday I think. (Or the following monday, but very soon)
Coding is now a piece of cake
The administrator has disabled public write access.

Builder not allowing field selection at all layers 26 Jul 2016 01:06 #14334

  • vlemos
  • vlemos's Avatar
  • Online
  • Elite Member
  • Posts: 295
  • Thank you received: 41
  • Karma: 21
To enable readonly, for an input-box 2 files must be updated:
1. . . ./com_demo/models/fields/cktext.php
add 1 line to this file - 'readonly' => $this->getOption('readonly');

2. . . ./libraries/jdom/html/form/input/text.php
to this one add: var $readonly;
then in the constructor:
$this->arg('size' , 6, $args, '32');
if ($this->readonly)
$this->addSelector('readonly', 'readonly');[/code]

and in the build function:
. ' ' . $this->readonly


cktext.php
class CommuterCkFormFieldCktext extends CommuterClassFormField
{
	/**
	* The form field type.
	*
	* @var string
	*/
	public $type = 'cktext';

	/**
	* Method to get the field input markup.
	*
	* @access	public
	*
	*
	* @since	11.1
	*
	* @return	string	The field input markup.
	*/
	public function getInput()
	{

		$this->input = JDom::_('html.form.input.text', array_merge(array(
				'dataKey' => $this->getOption('name'),
				'domClass' => $this->getOption('class'),
				'domId' => $this->id,
				'domName' => $this->name,
				'dataValue' => $this->value,
				'placeholder' => $this->getOption('placeholder'),
				'readonly' => $this->getOption('readonly'),
                                'hidden' => $this->getOption('hidden'),

text.php
class JDomHtmlFormInputText extends JDomHtmlFormInput
{
	var $readonly;
        var $hidden;
	var $size;
function __construct($args)
	{
		parent::__construct($args);

		$this->arg('readonly'   , null, $args);
                $this->arg('hidden       , null, $args);
		$this->arg('size'            , 6, $args, '32');

		if ($this->readonly)
			$this->addSelector('readonly', 'readonly');

		if ($this->hidden)
			$this->type = 'hidden';
function build()
	{
		$html =	'<%PREFIX%><input type="' . $this->type . '" id="<%DOM_ID%>" name="<%INPUT_NAME%>"<%STYLE%><%CLASS%><%SELECTORS%>'
			.	' value="<%VALUE%>"'
			.	' ' . $this->readonly
			.	' size="' . $this->size . '"'
			.	'/><%SUFFIX%>' .LN
			.	'<%VALIDOR_ICON%>'.LN
			.	'<%MESSAGE%>';
Last Edit: 26 Jul 2016 13:56 by vlemos.
The administrator has disabled public write access.
Time to create page: 0.150 seconds

Get Started