SmartFAQ is developed by The SmartFactory (https://www.smartfactory.ca), a division of InBox Solutions (https://www.inboxsolutions.net)

How to make xoopsformhidden xhtml-valid?
Remark: I don't know if this is really a FAQ. But this one disturbed me when making my page xhtml-valid. There are two possible solutions. 1. make a tray with another formelement inside a module or 2. make the change systemwide which is much easier for the non-php-techie. Look for function render in include/xoopsform/xoopsformhidden.php and the line which reads:
le="color: #000000"><?php return "<input type='hidden' name='".$this->getName()."' id='".$this->getName()."' value='".$this->getValue()."' />";
Problem with this code is, that the input-field for hidden will inserted between the tr-lines of the table which is not xhtml-valid. Just change the above line to:
le="color: #000000"><?php return "<tr style='display:none;'><td colspan='2' style='display:none;'><input type='hidden' name='".$this->getName()."' id='".$this->getName()."' value='".$this->getValue()."' /></td></tr>";
What I did was just inserting another table-row. To prevent the new table-row from being displayed I used the style display:none. That is all!


The comments are owned by the author. We aren't responsible for their content.
user

 Problem with these solution


I had the same validation problem.

I made this update un the render function but these function seems to be used in (a least one) other places.

With this modification, when you want to update a module (after a template modification), the update and cancel buttons are placed just under the header...

 
user

 Another solution


Hi all, I've finally found another solution (thanks to an xoops-france member)...

There is no need modifying formhidden.

First, just modify the file class/themeform.php and replace

le="color: #000000"><?php } else { $ret .= $ele->render()."n"; }

by
le="color: #000000"><?php } else { $hiddens .= $ele->render()."n"; }


and the replace just after this line
le="color: #000000"><?php $ret .= "</table></form>n";

by
le="color: #000000"><?php $ret .= "</table>".$hiddens."</form>n";


The function render() will now produce an html valid form.

For the contact module, there is another modification. Indeed, there is no need for a simple form to use a template, XOOPS can do it perfectly well. So in the file modules/contact/index.php comment the above two lines
le="color: #000000"><?php ... $xoopsOption['template_main'] = 'contact_contactusform.html'; ... $contact_form->assign($xoopsTpl);


and then add the following line to the modules/contact/contactform.php
le="color: #000000"><?php $contact_form->display();

after the last $contact_form->addElement

That's done, you will now have a valid html contact form.

 


Login

Donat-O-Meter

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