Subject:*
<
Name/Email:*
<
Message Icon:*
<
Select*
<
Message:*
<



Click the Preview to see the content in action.
Options:*
<
Confirmation Code*
<
4 + 9 = ?  
Input the result from the expression
Maximum attempts you can try: 10
*
<
     

Re: Add Javascript Alert to XoopsFormButton?
by Peekay on 2010/5/9 12:26:34

Thx for responding Bandit-X. Much appreciated.

I have discovered that the form I was working on had been given the same name as another search form in a block that was also visible on the page.

It appears that the name conflict stopped the button class validation from triggering.

I changed the names and it works now.
Re: Add Javascript Alert to XoopsFormButton?
by iHackCode on 2010/5/9 3:42:11

try using setExtra.

ex:
le="color: #000000"><?php $search_form->setExtra('onsubmit="javascript:return validate_my_form();"');


Quote:
Can anyone put me out of my misery and tell me how to trigger a JS alert for an empty field when the submit button is pressed?


i thought there was an option for each element if they are to be required or not when you enter them into the form object..
Add Javascript Alert to XoopsFormButton?
by Peekay on 2010/5/8 22:40:44

I want to add some simple form validation with a javascript alert. I know how to do this with a conventional submit button, e.g.

le="color: #000000"><?php onsubmit="javascript:return validate_my_form();"


however, the form I am editing uses the Xoops form-button object. This particular form submits to another file and simply making the fields required (true) does not seem to work.

The button code looks like this.

le="color: #000000"><?php $search_form->addElement(new XoopsFormButton("", "submit", _SEARCH, "submit"), true);


I am no wiser about hacking the 'form' tag either

le="color: #000000"><?php $search_form = new XoopsThemeForm(_MD_SEARCH, "search", "search.php?search=1");


Can anyone put me out of my misery and tell me how to trigger a JS alert for an empty field when the submit button is pressed?

Who's Online

880 user(s) are online (794 user(s) are browsing Support Forums)


Members: 0


Guests: 880


more...

Donat-O-Meter

Stats
Goal: $15.00
Due Date: Jul 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $15.00
Make donations with PayPal!

Latest GitHub Commits