We’re rewarding the question askers & reputations are being recalculated! Read more.
4

The required="required" is standard HTML5 validation, - the html5fallback.js is just a polyfill for those browsers that do not support html5 validations. To answer your question add novalidate to your <form> markup: <form novalidate> .... </form> This turns off html5 validation.


4

It seems that you actually have to specify what the path is for and put it in the right place, lol! The problem was in specifying a path for the fields instead of for the rules! This correction fixed the problem: <form> <fields name="params" addrulepath="/administrator/components/com_mycomponent/models/rules">


4

You can create a custom rule for validation. For example your module name is mod_mymodule: Add addrulepath attribute to the fieldset in the .xml file: addrulepath="modules/mod_mymodule" This will be the path to the custom rule folder. Add validate attribute to the field with the name of the rule file: validate="testint" This will give us the file ...


4

As previously suggested, it is better to manage errors without introducing conditionals into business logic. You can just throw exceptions and catch them at the highest level, where you can encode to Json (and avoid a redirection). Tip: One nasty aspect, even though you close app, any extension can add HTML to your Json data output, namenly Jomsocial. A ...


3

The best solution would be to use preg_match() with a regular expression. One I've used before is: ((mailto\:|(news|(ht|f)tp(s?))|telnet|webcal|rss|nntp|file\://){1}\S+) You can also search and find many other variations that are suited for specific tasks.


3

You need to add &format=raw at the end of the URL so it will look like the following: index.php?option=com_component&task=checkDomain&tmpl=component&format=raw Hope this helps


2

Let's say I've custom validator "validemail" added in my form XML: <field type="text" label="COM_HELPDESK_CC_LABEL" description="COM_HELPDESK_EMAIL_DESCRIPTION" name="cc" class="form-control validate-validemail" validate = "validemail" /> My server Side validation Code ...


2

Another solution is not to use JToolBar at all. Do really need it? Simply make your button like this ("Cancel" button for example): <button type="button" class="btn" onclick="Joomla.submitbutton('contact.cancel')"> <span class="icon-cancel"></span>&#160;<?php echo JText::_('JCANCEL') ?> </button> Then in JS: Joomla....


2

It seems, that this is a problem of Joomlas custom JToolBar, which is used here to create a Toolbar for the front end. see last paragraph: https://docs.joomla.org/Client-side_form_validation The problem is, that the work around of this article does not work! Meanwhile I found the problem. If you have a closer look to the button code, which will be ...


2

There are several ways to prevent an auto submit: Attach the handler to the button, instead of form and return false to stop any further action Remove action attribute from form tag, you can define the URL in a different way when it is ready to be submitted Additionally, Joomla works based on global Joomla.submitform routine. You can create your own ...


2

I managed to achieve this via setFieldAttribute. In the XML form I removed the field2 required property and set that dynamically in the form as below. echo $this->form->renderField('field1'); if (condition){ $this->form->setFieldAttribute('field2','required','required'); echo $this->form->renderField('field2'); } Not sure whether ...


2

Joomla has no 'url' filter defined, you can check available filters at this url Secure coding guidelines Also, you can extend JInput class if you want, but I don't think it's worth. For permanent override of JInput or JFilterInput, you must write a plugin, here is a example: Override Core Joomla! Classes


2

You can override the JForm class with your own version in one of two ways: System Plugin Via a System plugin that triggers onAfterInitialise(): /** * Registers core library overrides. * * @return void */ public function onAfterInitialise() { // Override /libraries/joomla/form/form.php JLoader::register('JForm', JPATH_LIBRARIES . '/core-...


1

To prevent invalid values from being passed to the parent window, you can create an override of mediafield.js (and minified mediafield.min.js) which is located in /media/media/js/ folder. Add your filtering/validation here: // bind insert content.on('click', self.options.buttonSaveSelected, function(){ var value = content.find('#...


1

If the data you are protecting doesn't contain personally identifiable information I would say that the joomla's stock server-side validation should be plenty for you to use and feel safe. The validation rules may not have everything you need though. If you truly worry I would say use joomla's rules and possible add on to or make your own rule sets for the ...


1

It appears you are submitting the from without executing the validation. Using jQuery, you could listen for the form submit event, check validation and submit the form if it passes. At the top of your PHP file add the following to load the jQuery library: JHtml::_('jquery.framework'); Add the below JS to the page inside a script tag: (function($) { ...


1

Admittedly filter_var($url, FILTER_VALIDATE_URL) is imperfect, but regex is likely to be more so (and as the accuracy of the regex pattern improves, code-bloat will swell and readability/maintainability will plummet). As PHP continues to improve with each new version, the accuracy of filter_var() will only get better. If you roll your own static regex ...


1

I managed to run this validation by small work around. I moved ajax request to input blur method and in form validation hendler I just check some variables which was set after ajax request: jQuery(document).ready(function() { jQuery("#jform_email").blur(function(){ email = jQuery("#" + this.id).val(); jQuery(".email_message").html(''); ...


1

It is automatic validation by your browser because required attributed is set on the input field. Here is a list of browsers that support this: http://caniuse.com/#feat=form-validation


1

I got this solved by making sure the following conditions met allow_url_fopen = On in your PHP configuration jQuery is loaded on my page, if it is not loading, your template or some plugin might be suppressing somehow. check with your template developer.


1

If your model extends JModelAdmin or JModelForm, you can use its validate function to validate client input before saving it to database. class MyComponentModelForm extends JModelAdmin { .... .... /* Override */ public function validate($form, $data, $group = null) { $data = parent::validate($form, $data, $group = null); if(!$data || ...


1

You could use client side validation. So firstly, add the following to the form view (Choose one depending on your Joomla version) JHtml::_('behavior.formvalidation'); // Joomla 3.3 JHtml::_('behavior.formvalidator'); // Joomla 3.4 Then add the form-validate class to your form so it looks like this: <form class="form-validate"> Then add the ...


1

This is not a result of the layout that you are using but a limitation of the cancel button to skip the form validation on its own. Typically, you will need to implement something like this: JFactory::getDocument()->addScriptDeclaration(' Joomla.submitbutton = function(task) { if (task == "article.cancel" || document.formvalidator....


1

Firstly, Joomla v3.3 includes jQuery v1.11.1. You should not replace it with a previous version. It can cause general problems. Secondly, the Javascript validation routine is not included in the page. About the second validation, Joomla does not implement jQuery with the $ sign, you have to call it with jQuery, for example: jQuery('#checky').


Only top voted, non community-wiki answers of a minimum length are eligible