Skip Navigation

[Gelöst] Search field number format

This support ticket is created vor 7 Jahren, 6 Monaten. 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.

Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Dieses Thema enthält 8 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von Beda vor 7 Jahren, 6 Monaten.

Assistiert von: Beda.

Author
Artikel
#515616

Hi, im trying to achieve number format when user enter numeric value

currently its like 10000 i would like to have it as 10,000 . Pls advice. thanks

#515617

i manage to use function for the custom field but not sure about search field format.

#516000

I am not sure what you mean.

The Types Custom Field of type "number" only accepts dots, no commas.
We have some plans to enhance that, but for now this is the default and standard method.

For other formats you could use a Single Line field.

Does that suite your needs as well?

#516007

Hi Beda, thanks for replying over the weekend. Maybe i didn't explain clearly.

there is search box for price.
when i enter it display as usual 10000 . the price format is not there, i would like to have it such as 10,000 , the prefix i have no issue, but the number format i don't know how to achieve it.

my custom field has a function to display the price format , that looks good. but the front-end search form don't have similar format .

Please let me know if you still don't understand perhaps i can explain further. thanks

#516027

I udnerstand, but there is no inbuilt method to acheive that automaticallz, so let's say if a customer enters 10000, automatically it will create a query for 10,000.

This is not possible, how would you be sure the customer wants to search 10,000 and not 10000 or more complex?

You could try the filters of Views to modify that:
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_custom_field_filter_original_value
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_custom_field_filter_processed_value
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_custom_field_filter_type

This is a allover Tutorial how to use filters and hooks in WordPress and Toolset:
https://toolset.com/documentation/programmer-reference/toolset-hooks/

#516028

Hi beda

This is not possible, how would you be sure the customer wants to search 10,000 and not 10000 or more complex?

This is a good question,
i don't expect them to enter 10,000 its just the value will be changed automatically when they enter , i believe its ajax ?

search queries that's another part i didn't think of .
I was hoping all number to be sync in format.

#516154

Then you need Custom JS Code that I cannot provide here.

The Filters I provided are for PHP; it would not change the visible Value on the fly.

If you are versed in JS, you might write your code for that, and insert it into the JS Section in the Filter Editor.

If you need custom assistance for that, I would suggest you consider contacting one of our certified partners from this link:
https://toolset.com/consultant/

You will get the custom assistance you need to get on with your project.

Thank you for understanding.

#516669

Thanks. may i know how do i add this code into it please.
where do i add the cdn for the js code versteckter Link

#517254

That is a JS Library.
You should create a Theme, enqueue that library and then use the JS in the JS editors of Views as example.