Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

required for ckcombo type 17 Mar 2016 14:14 #13850

  • albert
  • albert's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 70
  • Thank you received: 2
Hi,

I did a component with a few combos and text fields,
now i should make them compulsory, so i go to com_name/models/forms/name.xml
and i add to the
<field name="observations"
...
required="true"
type="cktextarea"/>

and it works fine, if the field is empty i receive the warning

When i try to make the same for a type="ckcombo" (select list), it doesn't work, even empty is validating the form.
I tried to add several combinations of:
required="true"
validate="numeric"
class="required validate-numeric"

but it never works

can u help me please ?

Albert

Please Log in or Create an account to join the conversation.

required for ckcombo type 18 Mar 2016 13:45 #13851

Hi Albert.

Read this topic:
www.j-cook.pro/index.php/forum/19-new-ti...elect-not-validating

Will probably help you solve it.

Please Log in or Create an account to join the conversation.

required for ckcombo type 18 Mar 2016 14:00 #13852

  • albert
  • albert's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 70
  • Thank you received: 2
Hi,

Thanks but i already tried
i added:
<script>
(function($){
$("#adminForm").validationEngine('attach',{prettySelect:true,useSuffix:"_chzn"});
})(jQuery)
</script>

i also tried to comment out
//JHtml::_('formbehavior.chosen', 'select');
from helper.php :: headerDeclarations()

and nothing, when i save the form, the combo with required="true" is validated even without selecting any item

Please Log in or Create an account to join the conversation.

required for ckcombo type 18 Mar 2016 14:19 #13853

Yes, that is actuaclly wrong

It should be:
<script>
(function($){
	$(document).ready(function () {
			$("#adminForm").validationEngine('attach',{prettySelect:true,useSuffix:"_chzn"});
	});
})(jQuery)
</script>

Mind the: $(document).ready(function () {

Please Log in or Create an account to join the conversation.

required for ckcombo type 18 Mar 2016 15:43 #13854

  • albert
  • albert's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 70
  • Thank you received: 2
Hi, it continue without working, i placed on:
com_xxx/fork/views/xxx/tmpl/xxx.php


defined('_JEXEC') or die('Restricted access');


ComprasHelper::headerDeclarations();
//Load the formvalidator scripts requirements.
JDom::_('html.toolbar');
?>
<script language="javascript" type="text/javascript">
//Secure the user navigation on the page, in order preserve datas.
var holdForm = true;
/*window.onbeforeunload = function closeIt(){ if (holdForm) return false;};*/

(function($){
$(document).ready(function () {
$("#adminForm").validationEngine('attach',{prettySelect:true,useSuffix:"_chzn"});
});
})(jQuery)

</script>
<?php
..
.
.

but it continues without validating
if i inspect the code, i do not see the required, i see:
<select id="jform_ip_id" name="jform[ip_id]" class="chzn-done" style="display: none;">
<option value="" selected="selected">- Select IP -</option>
<option value="952">A</option>
<option value="1371">B</option>
...
</select>

Please Log in or Create an account to join the conversation.

required for ckcombo type 18 Mar 2016 20:41 #13855

A little further down there will probably be (when inspecting your html) someting like:
<div class="chzn-container chzn-container-single chzn-container-single-nosearch" style="width: 220px;" title="" id="jform_ip_id_chzn"><a class="chzn-single" tabindex="-1"><span>- Select IP -</span>
That is where the _chzn suffix is.

I have my piece op code in the _form.php, just after
<?php $fieldSet = $this->form->getFieldset('xxxx.form');?>

Does a jquery error show up in the console perhaps?

Hope it helps
The following user(s) said Thank You: admin

Please Log in or Create an account to join the conversation.

Last edit: by Romkabouter.

required for ckcombo type 23 Mar 2016 10:37 #13865

  • albert
  • albert's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 70
  • Thank you received: 2
Hi, now by adding the code i get:


<select id="jform_ip_id" name="jform[ip_id]" required="required">
<option value="" selected="selected">- Select ICMAB IP -</option>
....
</select>

when i click on the selct box the border is red (good signal), but when i click on submit, the form is accepting the empty value !!
it is very strange because another fields (for instance a text one) is validating properly

no messages on the console

we are getting close ...

Please Log in or Create an account to join the conversation.

required for ckcombo type 02 May 2016 13:36 #13926

  • albert
  • albert's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 70
  • Thank you received: 2
any idea ??
i am still stuck with no validation

Please Log in or Create an account to join the conversation.

required for ckcombo type 05 May 2016 20:38 #13928

If it is no problem for you, please attach an installable zip file of your component or send me an email on This email address is being protected from spambots. You need JavaScript enabled to view it.
I can then install it and see what is the problem.

Also I need the forked files offcourse :)
The following user(s) said Thank You: albert

Please Log in or Create an account to join the conversation.

required for ckcombo type 09 May 2016 09:04 #13929

  • albert
  • albert's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 70
  • Thank you received: 2
Hi,

Now i made it work, i started from scratch again!
maybe when i did the fork i did something wrong !

Apology for so many emails.

Albert

Please Log in or Create an account to join the conversation.

required for ckcombo type 09 May 2016 09:11 #13930

Great, no worries. We are here to help to the best we can :)

Please Log in or Create an account to join the conversation.

required for ckcombo type 09 May 2016 10:47 #13934

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
Hi Albert,
The fix of Romkabouter is now integrated in the new version.
You can remove your fork. Sorry, I was too late on this one it could have avoid you some work.

Cheers.
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.083 seconds

First let me congratulate you on an excellent/outstanding product. Just tried for one hour but was very impressed.
Marret (Forum)

Get Started