Bootstrap custom field inputbox change class

  • Posts: 147
  • Thank you received: 6
8 years 9 months ago #228051

Hi,
I created an override for registration_bootstrap and one for custom_fields_boostrap
I was able to change the html container just fine however I can find how to change the class 'inputbox'
I need to use 'form-control' as the input field class.

Thanks, appreciate the help.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
8 years 9 months ago #228055

Hi,

This class is set in a core file, the file "administrator/components/com_hikashop/classes/field.php", so editing this file is not a very good idea, every time you will update the changes will be lost.

So two solutions can be present, create an override of that class, or add some javascript in your template js file to replace the class of these specific html elements.

Please Log in or Create an account to join the conversation.

  • Posts: 147
  • Thank you received: 6
8 years 9 months ago #228100

Hi xavier, thanks for getting back to me.
Would it be possible to use setFieldAttribute('fieldName', 'class', 'myclass')

In the custom_fields_boostrap override at all?

Just a small feedback note you guys may consider for future releases:
field and markup classes is something that in my opnion should always be an easy thing to change/add. A number of templates use different css frameworks, been able to use an specific framework class will help reduce the duplication in styles.

I appreciate e can change the container in the custom_fields_boostrap but changing the field classes would also be handy.

;)

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
8 years 9 months ago #228196

Hi,

You don't need to edit directly the core file as Xavier said.
You can actually do that change directly in the custom_fields_boostrap view file as an override.
Just change the code :

echo $this->fieldsClass->display(
			$oneExtraField,
			@$this->$type->$fieldName,
			'data['.$type.']['.$fieldName.']',
			false,
			' '.$onWhat.'="hikashopToggleFields(this.value,\''.$fieldName.'\',\''.$type.'\',0);"',
			false,
			$this->extraFields[$type],
			$this->$type
	);
to:
echo str_replace('inputbox','form-control', $this->fieldsClass->display(
			$oneExtraField,
			@$this->$type->$fieldName,
			'data['.$type.']['.$fieldName.']',
			false,
			' '.$onWhat.'="hikashopToggleFields(this.value,\''.$fieldName.'\',\''.$type.'\',0);"',
			false,
			$this->extraFields[$type],
			$this->$type)
	);

The following user(s) said Thank You: maujbigo

Please Log in or Create an account to join the conversation.

  • Posts: 147
  • Thank you received: 6
8 years 9 months ago #228345

Cool, thanks for that.

Please Log in or Create an account to join the conversation.

  • Posts: 4
  • Thank you received: 0
5 years 2 weeks ago #312831

Hello, its grade, Thank you .
But same problem , please help.
i have the code

///////
foreach($this->leftFilters as $name => $filterObj) {
		if(is_string($filterObj))
			echo $filterObj;

		else
			echo  $filterObj->displayFilter($name, $this->pageInfo->filter);  
	}
/////////
in view file - order/listing.php

How to change class="inputbox" to class="someclass"

Last edit: 5 years 2 weeks ago by nicolas.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
5 years 2 weeks ago #312847

Hi,

You can change the line:

echo  $filterObj->displayFilter($name, $this->pageInfo->filter);
to:
echo  str_replace('class="inputbox"', 'class="someclass"', $filterObj->displayFilter($name, $this->pageInfo->filter));
It's basically the same solution as explained before.

Please Log in or Create an account to join the conversation.

  • Posts: 4
  • Thank you received: 0
5 years 2 weeks ago #312883

Sorry , on this place the code, it not work, you could try it yourself

I solved this problem that

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
$( ".inputbox" ).removeClass( "inputbox" ).addClass( "form-control" );
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

in my template.js , on ( document ).ready

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
5 years 2 weeks ago #312899

Hi,

That's a possibility too. In fact the great thing with your proposal is that it will work for all the views where there are dropdowns with the inputbox class without having to edit each place. So it's even better.

Please Log in or Create an account to join the conversation.

Time to create page: 0.082 seconds
Powered by Kunena Forum