Keyword

Problems making item form fields required!

  • gerardo
  • gerardo's Avatar Topic Author
  • Visitor
13 years 2 months ago #98403 by gerardo
Ok, I tried making three different fields from the item form required but I have a different problem with each.

 

First I tried making the first field from my Extra Fields required, so I used this:

 

} else if (trim( document.adminForm.K2ExtraField_1.value ) == "") {            alert( '<?php echo JText::_('You must fill Extra Field 1', true); ?>' );

 

The problem was that I was then unable to save items from categories without extra fields. Do you know a way of making the extra field required ONLY IF one of certain categories were chosen?

 

 

Then I tried making the content field, the one for text with the editor, required. I used this:

 

} else if (trim( document.adminForm.text.value ) == "") {             alert( '<?php echo JText::_('You must fill the description in the Content tab', true); ?>' );

 

But then I couldn't save items untill I pressed the "toggle editor" button and left the text area without editor. I don't get why that happened. What would I have to do to make that field required without having to loose my editor for saving? 

 

 

Finally I tried making the tags field required. I tried this then:

 

} else if (trim( document.adminForm.tags[].value ) == "") {            alert( '<?php echo JText::_('You must attach tags to the item.', true); ?>' );

 

I really don't know about "tags[]". Anyway, after putting that in the code I could still save the form even though I left the tags field empty. Do you know what I had to write to make the tags field required?

 

 

Could you help me with any of the three fields or all three of them?

 

Thank you in advance!

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

  • gerardo
  • gerardo's Avatar Topic Author
  • Visitor
13 years 2 months ago #98404 by gerardo
Replied by gerardo on topic Problems making item form fields required!
Can any one help me with this PLEASE?!

 

I really need this!

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

  • gerardo
  • gerardo's Avatar Topic Author
  • Visitor
13 years 2 months ago #98405 by gerardo
Replied by gerardo on topic Problems making item form fields required!
ANY NEW THOUGHTS ABOUT THIS?!

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


Powered by Kunena Forum