Skip Navigation

[Resolved] Is it possible to display number field as input?

This support ticket is created 5 years, 7 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 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 6 replies, has 2 voices.

Last updated by martinH-10 5 years, 7 months ago.

Assisted by: Luo Yang.

Author
Posts
#1283561

Tell us what you are trying to do? I am trying to use custom js library to display custom field as input slider.

Is it possible, to display this shortcode:

[cred_field field='cislo-1' force_type='field' class='form-control' output='bootstrap' value='0']

like input with some classes:

<input id="ex8" data-slider-id='ex1Slider' type="text" data-slider-min="0" data-slider-max="20" data-slider-step="1" data-slider-value="14"/>

I am trying to use the bootstrap slider from here <link>hidden link;

It works for inputs. But is it possible to display cred_field as raw input?

#1283673

Hello,

It needs custom JS codes, for example, the Toolset Form shortcode [cred_field ...] will output a HTML input tag, you can setup JS codes to add/modify the HTML attributes of input tag to what you want:
hidden link

I suggest you try to follow their document to setup those HTML attributes :
hidden link
section "Using bootstrap-slider (via data-provide-API)"

And I suggest you use "cred_form_ready" event to trigger your custom JS codes, see similar thread here:
https://toolset.com/forums/topic/limit-date-range-for-cred-form-date-field/

#1283831

My issue is resolved now. Thank you!

#1283917

Ok I tried to use it as you suggested:

jQuery(document).on('cred_form_ready', function() {
  
jQuery( "#cred_form_2207_2-textfield-1-1562228545" ).attr({
	data-provide="slider",
	data-slider-ticks="[1, 2, 3]",
	data-slider-ticks-labels='["short", "medium", "long"]',
	data-slider-min="0",
	data-slider-max="30",
	data-slider-step="1",
	data-slider-value="1",
	data-slider-tooltip="hide"
});
  
});

But it doesnt work. Any ideas?

#1283927

I also tried

jQuery( "input[name*='wpcf-cislo-1']" ).attr({

Not working 🙁

#1284425

Since it is a custom JS codes problem, please provide a test site with the same problem, also point out the problem page URL, I need to test and debug it in a live website. thanks

#1288493

I dont need it anymore.