• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Disable spaces in Input ?

Disable spaces in Input ? 9 years 5 months ago #33157

Hi,

How can i Disable spaces in Input please ?

Example : I Like choco
> ilikechoco

I try this code but it don't work : jsfiddle.net/jquerybyexample/MwEkj/

Thank you !
The administrator has disabled public write access.

Disable spaces in Input ? 9 years 5 months ago #33173

Up please
The administrator has disabled public write access.

Disable spaces in Input ? 9 years 5 months ago #33176

  • alexp
  • alexp's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 2253
  • Thank you received: 180
There are two ways to achieve this:

- Javascript solution: create an onkeyup function that won't allow you to type in spaces.
- PHP solution, where you process the input after the form has been submitted. For example, PHP Scripts, Scripts called on form process, add the following PHP code:
if(empty($invalid)){
$_POST['form']['name of field'] = str_replace(' ','',$_POST['form']['name of field']);
}
Please note: my help is not official customer support. To receive your support, submit a ticket by clicking here
Regards,
RSJoomla! Development Team
The administrator has disabled public write access.

Disable spaces in Input ? 9 years 5 months ago #33185

Hi,

Thank you but it don't work...

The administrator has disabled public write access.

Disable spaces in Input ? 9 years 5 months ago #33188

Haven't tried, but when I looked it said Not to include <?php
The administrator has disabled public write access.

Disable spaces in Input ? 9 years 5 months ago #33210

Up please
The administrator has disabled public write access.

Disable spaces in Input ? 9 years 5 months ago #33211

  • alexp
  • alexp's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 2253
  • Thank you received: 180
Are you sure you used the correct field names ? The script is correct.
Please note: my help is not official customer support. To receive your support, submit a ticket by clicking here
Regards,
RSJoomla! Development Team
The administrator has disabled public write access.

Disable spaces in Input ? 9 years 5 months ago #33239

Hi,

Thnak you but It don't work for me.

And it's a correct field name...

My field name is "IBAN" (please see attachement)



Edit : Should I Replace by the form id ?

Thank you
Last Edit: 9 years 5 months ago by righi.billal.
The administrator has disabled public write access.

Disable spaces in Input ? 9 years 5 months ago #33285

  • alexp
  • alexp's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 2253
  • Thank you received: 180
Please post a link to the form, and a screenshot with your script.
Please note: my help is not official customer support. To receive your support, submit a ticket by clicking here
Regards,
RSJoomla! Development Team
The administrator has disabled public write access.

Disable spaces in Input ? 9 years 4 months ago #33311

Yes, thank you :

Form link : (field concerned : IBAN)

Screenshot 1




Screenshot 2



Thank you
Last Edit: 9 years 4 months ago by righi.billal.
The administrator has disabled public write access.

Disable spaces in Input ? 9 years 4 months ago #33330

  • alexp
  • alexp's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 2253
  • Thank you received: 180
No screenshots available...
Please note: my help is not official customer support. To receive your support, submit a ticket by clicking here
Regards,
RSJoomla! Development Team
The administrator has disabled public write access.

Disable spaces in Input ? 9 years 4 months ago #33353

The administrator has disabled public write access.

Disable spaces in Input ? 9 years 4 months ago #33366

  • alexp
  • alexp's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 2253
  • Thank you received: 180
The text just above your script states that you shouldn't included the php tags...
Please note: my help is not official customer support. To receive your support, submit a ticket by clicking here
Regards,
RSJoomla! Development Team
The administrator has disabled public write access.

Disable spaces in Input ? 9 years 4 months ago #33373

Even without php tags it still does not work...
The administrator has disabled public write access.

Disable spaces in Input ? 9 years 4 months ago #33374

I finally found the right code in javascript :
<script type="text/javascript">
        function removeWhitespaces() {
            var txtbox = document.getElementById('NAME_FIELD');
            txtbox.value = txtbox.value.replace(/\s/g, "");
        }
    </script>

And in FIELD Additional attributed :
onclick="removeWhitespaces()"

thank you anyway for your help !
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!