formbuilder pulldown problem

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Locked
pumuklee

formbuilder pulldown problem

Post by pumuklee »

hi

i have a pulldown in my page

name                    value

english                  en
deutsch                de
espaniola              es

but the result is something like this

Code: Select all

<form id="m3moduleform-1" name="m3moduleform-1" method="post" action="index.php" enctype="multipart/form-data">
...
<div class="languageform"><select name="m3_7"><option value="" selected="selected">  </option><option value="1">deutsch</option><option value="2">english</option><option value="3">espaniola</option></select>
<input name="m3submit" value=">>" type="submit" class="fbsubmit" />
...
</form>
my probelm is that the option values are 1, 2, 3 not en, de, es which i was inserted in admin part
1. how can i handel this problem?

2. how can i change the method of the form to get?

thanks
TimMansell

Re: formbuilder pulldown problem

Post by TimMansell »

Hi, I managed to find a work-around for this.  If you have access to the FTP server then try this.

Edit the file called 'PulldownField.class.php' in the folder 'modules/FormBuilder/classes/'.

Change the code:

$subjects = &$this->GetOptionRef('option_name');
if (count($subjects) > 1) {
  for($i=0;$iGetOption('sort') == '1' ) {
    ksort($sorted);
  }
}

To: (changes in red italics)

$subjects = &$this->GetOptionRef('option_name');
$subjects_val = &$this->GetOptionRef('option_value');
if (count($subjects) > 1) {
  for($i=0;$iGetOption('sort') == '1' ) {
    ksort($sorted);
  }
}
Feel
New Member
New Member
Posts: 4
Joined: Sat Mar 28, 2009 11:02 am

Re: formbuilder pulldown problem

Post by Feel »

Hello,
This solution helped me a lot. I used it in conjunction with an auto_load of datas in the pulldown menu.
During my tests, I saw that the solution gave by Tim works well only if you have more than 1 entry in the select.
Then I've done the modifications (in red) below :

$subjects = &$this->GetOptionRef('option_name');
$subjects_val = &$this->GetOptionRef('option_value');
if (count($subjects) > 1 && is_array($subjects)) {
  for($i=0;$iGetOption('sort') == '1' ) {
    ksort($sorted);
  }
} else {
   $sorted[$subjects] = !empty($subjects_val)?$subjects_val:'1';
}


Hope it helps.
Last edited by Feel on Tue Mar 31, 2009 12:01 pm, edited 1 time in total.
clc
Forum Members
Forum Members
Posts: 26
Joined: Fri Feb 27, 2009 6:00 am

Re: formbuilder pulldown problem

Post by clc »

Hi all,

Thanks!  This is exactly what I've been looking for, except that I'm trying to do it with the "Email results based on pulldown" field type instead of the regular "Pulldown" type, and I can't quite get it to work when it comes to the form submission. 

I *have* been able to get it to change the option values by editing the similar code (in DispositionDirector.class.php rather than PulldownField.class.php), but I'm getting an SMTP error when I try to submit.  Which I'm assuming is because the actual e-mail routing is tied to the numerical option values rather than the subject values.  Unfortunately I can't seem to find this part of the code -- can anyone point me in the right direction?

Thanks!
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: formbuilder pulldown problem

Post by Dr.CSS »

Maybe your smtp error is from the mailer not being setup correctly, but if you had given full info we would know because you would have said, my cmsmailer is set right as I can send a test email and it works, something like that...
clc
Forum Members
Forum Members
Posts: 26
Joined: Fri Feb 27, 2009 6:00 am

Re: formbuilder pulldown problem

Post by clc »

Hi Mark,

Thanks for the reply -- sorry, I forgot to specify that I only get the SMTP error when I change the option values -- otherwise the mail sending works fine.  That's why I'm assuming it's because the routing is tied to the numerical values.  I just don't know where to find the formbuilder code that connects the numerical option values back to the e-mail addresses after the form is submitted.  Does that make sense? Let me know what further info would be helpful for troubleshooting...

I'm on CMSMS 1.5.4, FormBuilder 0.5.11 and CMSMailer 1.73.14...

Thanks!
Locked

Return to “Modules/Add-Ons”