1
phillipd
How do you get a xoopsformselect gadget to call a function when selected?
  • 2004/10/30 5:57

  • phillipd

  • Quite a regular

  • Posts: 219

  • Since: 2004/4/20


I would like to call a function when a user selects one of the entries in a XoopsFormSelect gadget. How is this done? I don't see anything in the api to do this but I know it must be possible. I also tried:


$sites_select = new XoopsFormSelect("","sites");
$sites_tray = new XoopsFormElementTray(_MM_SITE, " ");
$sites_tray->addElement($sites_select);
$sites_select->addOption("","");

fill the $sites_select gadget from a DB select call ....

$site_select->setExtra("onchange='doSite()'");

Then:

function doSite() {
echo "Called doSite()";
}

This didn't work, my browser went blank and won't render anything on my form. Comment out the "setExtra()" line and form renders ok.

Thanks

Doug P

2
zoullou
Re: How do you get a xoopsformselect gadget to call a function when selected?
  • 2004/10/30 6:57

  • zoullou

  • Quite a regular

  • Posts: 250

  • Since: 2004/3/2 0


OnChange must call a javascript function and not a php function

3
phillipd
Re:How do you get a xoopsformselect gadget to call a function when selected?
  • 2004/10/30 17:00

  • phillipd

  • Quite a regular

  • Posts: 219

  • Since: 2004/4/20


Thanks for help! I'm somewhat of a newbie to javascript. How do you do that? Can I add some javascript right in my php file? A code snipit would really be nice here. Can javascript call the php script I'm currently in and give an argument to it so it will just reenter the php script where I want it to?

Is there perhaps a better way to do this other than Javascript. I'd kind of like to stick to php if possible.

Thanks

Doug P

Login

Who's Online

454 user(s) are online (75 user(s) are browsing Support Forums)


Members: 0


Guests: 454


more...

Donat-O-Meter

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

Latest GitHub Commits