1
eHobayyeb
Adding the default XOOPSForm?
  • 2008/7/4 19:02

  • eHobayyeb

  • Just popping in

  • Posts: 39

  • Since: 2007/2/27


Hi,

I am creating a module for XOOPS and want to add the default XOOPS form in my module.

How to do that?

Note: I am a new php programmer

Thanks

2
Mamba
Re: Adding the default XOOPSForm?
  • 2008/7/4 19:33

  • Mamba

  • Moderator

  • Posts: 11253

  • Since: 2004/4/23


Did you see this tutorial?
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

3
eHobayyeb
Re: Adding the default XOOPSForm?
  • 2008/7/4 20:12

  • eHobayyeb

  • Just popping in

  • Posts: 39

  • Since: 2007/2/27


Thanks

4
tcnet
Re: Adding the default XOOPSForm?
  • 2008/7/4 21:46

  • tcnet

  • Friend of XOOPS

  • Posts: 297

  • Since: 2006/5/12


Use the class/xoopsform. Look in the xoopsform directory for the available form elements.

Submit form example:
// USER SUBMIT FORM
include XOOPS_ROOT_PATH."/header.php";
include_once 
XOOPS_ROOT_PATH."/class/xoopsformloader.php";

$formlabel =    _MD_ADDNEWLINK;
$formname "usersubmitform";
$formaction XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/submit.php';
$formmethod "post";
$formaddtoken "false";    
$btnlabel _MD_ADD;

$sform = new XoopsThemeForm($formlabel$formname$formaction$formmethod$formaddtoken "false");  
$sform->setExtra('enctype="multipart/form-data"');

// Title
$sform->addElement(new XoopsFormText(_MD_TITLE'title'4060$title), true);

// Description
$sform->addElement(new XoopsFormTextArea(_MD_DESCRIPTION'description',$description,4,50), true);

// Submit buttons
$button_tray = new XoopsFormElementTray('','');
$submit_btn = new XoopsFormButton('''post'$btnlabel'submit');
$button_tray->addElement($submit_btn);
$sform->addElement($button_tray);        
$sform->display();

The submitted form goes to submit.php

include "header.php"
$myts =& MyTextSanitizer::getInstance();

// TITLE
$title = isset($_POST["title"]) ? $myts->addSlashes(($_POST["title"]);

// DESCRIPTION
$description $myts->addSlashes($_POST["description"]);

$newid $xoopsDB->genId($xoopsDB->prefix("modulename_table")."_lid_seq");    

$sql sprintf("INSERT INTO %s (lid, title, description) VALUES (%u, '%s', '%s')"$xoopsDB->prefix("modulename_table"), $newid$title$description);    
$xoopsDB->query($sql);


I suggest studying Herve's News module for help. Take a look at news/submit.php and his submit form at news/include/storyform.inc.php.

5
eHobayyeb
Re: Adding the default XOOPSForm?
  • 2008/7/6 2:43

  • eHobayyeb

  • Just popping in

  • Posts: 39

  • Since: 2007/2/27


Thanks

6
eHobayyeb
Re: Adding the default XOOPSForm?
  • 2008/7/6 3:08

  • eHobayyeb

  • Just popping in

  • Posts: 39

  • Since: 2007/2/27


Another thing!

Where is the best place to start reading about making XOOPS modules?

7
Mamba
Re: Adding the default XOOPSForm?
  • 2008/7/6 4:16

  • Mamba

  • Moderator

  • Posts: 11253

  • Since: 2004/4/23


Starting points on FAQ and Wiki:

https://xoops.org/modules/smartfaq/category.php?categoryid=16

https://xoops.org/modules/mediawiki/in ... /Module_Development_Guide

You can also try this attached older tutorial, and a module sample.
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

8
eHobayyeb
Re: Adding the default XOOPSForm?
  • 2008/7/6 23:08

  • eHobayyeb

  • Just popping in

  • Posts: 39

  • Since: 2007/2/27


Thanks you I will read them all!

Login

Who's Online

67 user(s) are online (40 user(s) are browsing Support Forums)


Members: 0


Guests: 67


more...

Donat-O-Meter

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

Latest GitHub Commits