Welcome, Guest
Username: Password: Remember me

TOPIC: (SOLVED): Where do you set a field to hidden?

(SOLVED): Where do you set a field to hidden? 01 Aug 2015 04:54 #13368

  • jonathanbell
  • jonathanbell's Avatar
  • Offline
  • Premium Member
  • Posts: 147
  • Thank you received: 5
  • Karma: 1
I have a field that I want hidden, but cannot see where to set the type. I've had a look at the view / modal and controller with no luck? Can someone please advise where to set this? I can't see class - controls in the css either? I really need some help as this is the last piece of the puzzle for my component. Can I set it amongst the following code for the input field?
<div class="controls">
			<?php echo $field->input; ?>
		</div>

In the form view I had
<div class="control-group <?php echo 'field-' . $field->id . $field->responsive; ?>">

I researched and have changed to
<div class="control-group <?php echo 'field-' . $field->id . $field->responsive; ?>">style="display:none">

which hides the corresponding field - this works on all fields in the view.
Last Edit: 03 Aug 2015 06:09 by jonathanbell. Reason: Found Solution so closed with answer
The administrator has disabled public write access.

(SOLVED): Where do you set a field to hidden? 03 Aug 2015 13:00 #13371

  • MorganL
  • MorganL's Avatar
  • Offline
  • Platinum Member
  • Posts: 438
  • Thank you received: 53
  • Karma: 16
I do a variance of this so I don't lose hidden fields or have to alter them individually

If I have a load of hidden fields that I will be injecting values in from the URL (POST / GET) I create a FORM BRICK called hidden (alias)

I then just give the entire brick a class of hidden and add .hidden {display:none;) to my component style sheet

All hidden variables neatly package in their own (view)_hidden.php TMPL file
Morgan Leecy MCSE

Novell / Linux
PHP. MYSQL, Apache, node.js
Coldfusion, JQuery, HTML5
Joomla
The administrator has disabled public write access.
The following user(s) said Thank You: admin, jonathanbell

(SOLVED): Where do you set a field to hidden? 04 Aug 2015 07:43 #13373

  • jonathanbell
  • jonathanbell's Avatar
  • Offline
  • Premium Member
  • Posts: 147
  • Thank you received: 5
  • Karma: 1
Thank you, I learn something new everyday, I'm sure there are more like me who are trying coding in a new language (me over 40) and struggle a little to ask the right question when searching or plain just don't understand what we are looking at. Anything new I learn as I go I will post as an answer. I'm sure if we all take the time to answer even the smallest question , even if only to point people in the right direction we all benefit.

So thanks Morgan, some of your advice on my previous questions has been invaluable. :) and I sincerely appreciate it.
Last Edit: 04 Aug 2015 07:47 by jonathanbell. Reason: Grammar needed fixing.
The administrator has disabled public write access.

(SOLVED): Where do you set a field to hidden? 04 Aug 2015 10:15 #13374

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 984
  • Karma: 140
Another way is far more easy : use the 'hidden' type (native Joomla)

In your XML form :
<field name="myFieldName" type="hidden"/>

Otherwise, if you are using JDom, you can also use the following control : 'html.form.input.hidden'

Simple isn't it ?
Coding is now a piece of cake
The administrator has disabled public write access.
The following user(s) said Thank You: jonathanbell
Time to create page: 0.200 seconds

Get Started