1
anemic
Enhancing registration form with onClick help
  • 2007/3/14 18:55

  • anemic

  • Just popping in

  • Posts: 36

  • Since: 2006/12/6


Hi,

I have a customized registration system where new members will have to select from popup windows to set certain registration values. The registrant chooses a value in the popup and I set the original registration form with the corresponding selection. This all works well. My problem is that the registration is using XoopsForm elements and these fields have a caption on the left and a textfield/area on the right. I'd like to customize some of the textfields to something like "Click Here to Change This Option". In the field I'd do an onClick to clear the field and then a popup select form. Right now my caption contains the field caption/description with an anchor titled 'Click Here to Set'. But you kind of have to look for anchor on the left..it's very easy to miss this option. The fields in question are used to provide customized meterological data and typing in the correct values would be out of the question. The only way to correctly set the field is with a popup.

I tried to add a custom input field to XOOPS form...I went to $xoopsroot/class/xoopsform, copied the XoopsFormText file, changed the references from XoopsFormText to XoopsFormTextMine and called it from the include/register.php code. The results are a white screen.

If anyone knows how to add a new XoopsForm element to which I can add onClick events or a clever way to add events like that to the current registration mechanism I'd love to hear about it.

2
anemic
Re: Enhancing registration form with onClick help
  • 2007/3/15 3:54

  • anemic

  • Just popping in

  • Posts: 36

  • Since: 2006/12/6


Hi,

As a work around I added code to the formtext.php file so that if the right field is passed into the form I do the correct popoup. Something like this
if( $this->getName() == 'MyField' ) {
    return 
".$this->getName()."'  id='".$this->getName()."' size='".$this->getSize()."' 
maxlength='"
.$this->getMaxlength()."' value='Click Here to   Change Field' 
onClick='clearText();window.open("
/Selections/MyFieldLauncher.htm","WindowName","location=0,status=0,scrollbars=0,menubar=0,resizable=1,width=493,height=655")' />";
} elseif( 
$this->getName() == 'MyField2' ) {
// Do MyField2 input statement
} else { 
// default formtext.php input field.
 
return ".$this->getName()."' id='".$this->getName()."' size='".$this->getSize()."' maxlength='".$this->getMaxlength()."' value='".$this->getValue()."'".$this->getExtra()." />";

}

clearText is a one line javascript routine to clear the field onClicking in it.

function clearText()
{
if (
document.userinfo.MyField.value == 'Click Here to   Change Field')
{
document.userinfo.Myfield.value "" ;
}
}

Login

Who's Online

309 user(s) are online (271 user(s) are browsing Support Forums)


Members: 0


Guests: 309


more...

Donat-O-Meter

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

Latest GitHub Commits