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

TOPIC:

Required FK select not validating 03 Nov 2015 15:40 #13654

Hi admin,

For this problem I have created an isolated problem project, FKTest.
It has two tables, table1 and table2.
Table2 has a FK field to table1, set as required

Adding an item to table2 and leaving the FK field empty, does not trigger an error.

Expected behavior: Clicking save will trigger error when no FK value is selected
Actual behavior: Clicking save saves item and leaves FK value empty

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

Required FK select not validating 03 Nov 2015 15:43 #13655

Some debugging what I did:

In the jquery.validationEngine.js there is a funciion _validateField.
In this function around line 460 the hidden property is checked: field.is(":hidden")
if (field.is(":hidden") && !options.prettySelect || field.parent().is(":hidden"))
 return false;
This is true for the select input, I did not investigate further.

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

Required FK select not validating 05 Nov 2015 19:34 #13657

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
JS validation

'chosen' library is causing the problem.
In :
helper.php :: headerDeclarations()

If you comment this line, then it works.
JHtml::_('formbehavior.chosen', 'select');

But the problem, is that will disable ALL select fields. I have no idea how to avoid chosen for a particular field.
For the JS, I will not dig more in because I don't want to hack the third-part library, and secondly this might be deprecated in the coming 'Pure' version.

PHP validation
In an other hand, it should at least validate at php level, this is a problem in facts.
I am checking and I tell you.
Coding is now a piece of cake

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

Required FK select not validating 06 Nov 2015 09:02 #13658

Do not make it a priority for me, I have created a workaround.
It is better I think to put you effort in the next pure version.

I will try the chosen statement and see what it brings.

Thanx

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

Required FK select not validating 11 Dec 2015 15:18 #13741

I have fixed it by adding
<script>
(function($){	
	$("#adminForm").validationEngine('attach',{prettySelect:true,useSuffix:"_chzn"});
})(jQuery)
</script>

in the form for the item (in my case component/fork/view/record/tpml/createrecord_form.php)
But I will take it one step further and fork the headerDeclaration, so I can utilize this on every form.
I did not test it with a relation field, but will soon

Validation also does not work on textarea with rich text editor (ajax validation that is, validation itself works)

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

Last edit: by Romkabouter.

Required FK select not validating 04 Jan 2016 19:38 #13760

Thats works BEAUTIFULLY for the non-ajax select box, many thanks!

Any ideas on fixing the same issue with ajax selectors?
Morgan Leecy MCSE

Novell / Linux
PHP. MYSQL, Apache, node.js
Coldfusion, JQuery, HTML5
Joomla

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

Required FK select not validating 05 Jan 2016 10:04 #13761

Great :)
Never used Ajax combo myself :D

Can you write down your desgin so I can recreate and test?

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

Required FK select not validating 05 Jan 2016 15:16 #13762

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
Good question.
It is possible as said by Romkabouter, that the jQuery conflict is the problem.

The ajax combo is gonna work much better in the "Pure" version, with a new Ajax mini framework.
This part is already done in my hands, but I cannot publish yet.

For me it seems working well on a fresh install, but you can avoid it at the moment if you have problems.
This is not Joomla standard. I have made this 'added' feature to answer the needs of some very engaged followers customers, but I don't like it that much because with Joomla! it is a pain to achieve it properly. I had many issues there in the past and still it continues to be unstable. So I rewrited all.

In the 'Pure' version, those ajax fields are defined in XML file, and handled by superclass. It is a beauty.
Can't wait to show you that stuff. ... Just hold your breath (again) for a while.
Coding is now a piece of cake

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

Required FK select not validating 09 May 2016 10:45 #13933

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
I have included your code (Romkabouter). It is really good one in facts !!!
It even works for AJAX combos.
This is a real combo !
One of the best fix ever ! I was digging that for so long...
K+++

Fixed since 2.8.2
Coding is now a piece of cake
The following user(s) said Thank You: Romkabouter

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

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

Your client support is really awesome + rich and powerfull software.
foo42 (Forum)

Get Started