xoops forums

irmtfan

Module Developer
Posted on: 2013/4/8 6:01
irmtfan
irmtfan (Show more)
Module Developer
Posts: 3419
Since: 2003/12/7
#11

Re: How to add a customValidationCode to xoopsFormValidate_blockform

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.

alain91

Just popping in
Posted on: 2013/4/8 18:30
alain91
alain91 (Show more)
Just popping in
Posts: 8
Since: 2012/11/11
#12

Re: How to add a customValidationCode to xoopsFormValidate_blockform

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.

irmtfan

Module Developer
Posted on: 2013/4/9 2:27
irmtfan
irmtfan (Show more)
Module Developer
Posts: 3419
Since: 2003/12/7
#13

Re: How to add a customValidationCode to xoopsFormValidate_blockform

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