11
irmtfan
Re: How to add a customValidationCode to xoopsFormValidate_blockform
  • 2013/4/8 6:01

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


see this picture
http://www.xoops.ir/uploads/newbb/15_51625bdce4886.jpg

the bigger red star is jQuery (which i dont know what is the function)

the smaller red star is xoopsform (xoopsFormValidate_blockform) which didnt work in options as you can see.

I hope somebody could find a solution for this.

12
alain91
Re: How to add a customValidationCode to xoopsFormValidate_blockform
  • 2013/4/8 18:30

  • alain91

  • Just popping in

  • Posts: 8

  • Since: 2012/11/11


You are right, there is not way at the moment to get the name of the Form.

But, there is a convention, and the name of the form is 'blockform'

So, just pass this name
class XoopsBlockForm extends XoopsForm
{
    public function 
__construct()
    {
        
parent::__construct('''blockform''');
    }


The red stars :

This works with xhtml but now xoops use HTML5. And html5 have new tags and attributs. One new attribut is named 'required'. using 'required' in an input tag automatically check if the field is empty and display a message in case of error. No javascript in needed.

After few tests, I found the 'required' attribute in input tag ignores the script in javascript. I will continue to investigate.

One could try to use addEelement with false for required parameter.


13
irmtfan
Re: How to add a customValidationCode to xoopsFormValidate_blockform
  • 2013/4/9 2:27

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


I tried a lot. none of the solution will work because the main issue is it create a nested form.
The only solution is finding a way to get the $form element and add new element to this $form

Login

Who's Online

285 user(s) are online (175 user(s) are browsing Support Forums)


Members: 0


Guests: 285


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits