Skip Navigation

[Resolved] Style the generic_field same as the cred_field

This support ticket is created 2 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 3 replies, has 2 voices.

Last updated by Shane 2 years, 11 months ago.

Assisted by: Shane.

Author
Posts
#2308581
Screenshot 2022-03-04 at 11.39.27 PM.png

Dear Sir/Madam,

I want to style the cred_generic_field same as the cred_field, refer to the screenshot, how can I style both select field same as the status select field, below is code I make the form

<div class="form-group">
      <div class="col-md-6 col-12">
		<label for="%%FORM_ID%%_@member-application.parent">[cred_i18n name='@member-application.parent-label']Applicant[/cred_i18n]</label>
		[cred_field field='@member-application.parent' class='form-control' output='bootstrap' select_text='--- not set ---' required='false' urlparam='mid'  readonly='readonly']
      </div>
</div>
...
<div class="form-group row">
      <div class="col-md-6 col-12">
		<label for="%%FORM_ID%%_app-proposed-tablet">[cred_i18n name='app-proposed-tablet-label']Select Tablet Number[/cred_i18n]</label>
        [cred_generic_field type='select' field='wpcf-app-proposed-tablet']
        {
          "required":1,
          "options":[ [get_tablet] ]
        }
		[/cred_generic_field]
      </div>
</div>
...
<div class="form-group row">
      <div class="col-md-4 col-12">
		<label for="%%FORM_ID%%_app-status">[cred_i18n name='app-status-label']Status[/cred_i18n]</label>
		[cred_field field='app-status' force_type='field' class='form-control' output='bootstrap']
      </div>
</div>
#2308721

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Kelvin,

Can you provide me with a link to the page so that I can provide the appropriate css code for this ?

Also when you say styling the select fields are you referring in terms of their width ?

Please let me know.

Thanks,
Shane

#2308925

Dear Shane,

I fixed it by styling the select tag with below style but not sure whether it is the best solution, regarding to the height and padding to the toolset_select2-selection, I have to manually find the value from inspector, is there any better way to calculate the value and all generic select field must be named as span.toolset_select2-selection.toolset_select2-selection--single?

.toolset_select2-selection {
  width: 100% !important;
}

span.toolset_select2-selection.toolset_select2-selection--single {
  height: 38px;
  padding-top: 3px;
  padding-left: 10px;
}

I add below script to enable the default select to select2

jQuery(document).ready(function() {
    jQuery('select[name="wpcf-custom-field-slug"]').toolset_select2();
});
#2310269

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Kelvin,

Usually this what is done to find what the exact class of the element is.

I'm not aware of any way to automatically determine what the classes will be.
all generic select field must be named as span.toolset_select2-selection.toolset_select2-selection--single?

For this I cannot say yes or no to based on my previous statement. The classes are dynamically generated and may contain variances from one instance to another so the best thing to do is to inspect the page element to find the correct class name.

Thanks,
Shane