Forum Index >  glFusion >  glFusion Add-on, Plugin Support New Topic Post Reply
 Forms 0.1.1
First | Previous | 1 2 3 | Next | Last    |  Printable Version
By: Rocky (offline)  Dec 10 2010 08:21 am (Read 6324 times)  
Rocky

Lee, thanks for releasing Forms Plugin Beta 2.

I am trying to test out the calculation feature, but I am quite thick to figure out how to use it. I hope I can ask the right questions to get an idea.

First, what is the "Numeric" field for? I created a field (name Rate). I typed in a value (10). I have no idea what "Format" or "Format string" means, so I left it blank. When I view the form, there is nothing next to the field label Rate:

I don't get the calculation field either. Since they don't appear on the form.

Sorry for being so dumb. Please let me create a scenario.

Let say, I am organizing a conference event for my Rotary club. I want them each to fill in the form indicating whether s/he wants a single room and double room, with different rates. They also need to choose whether they will take the bus or drive. If they take the bus, there will be a bus fare added. And another field for choosing whether they want meal, at a fixed rate. At the end of the form they will see the total cost of their registration. How should I use the field types you have created on the Forms plugin?

Thanks!

Sam

Forum Active Member
Active Member

Group Comfort
Level:
: +5

Registered: 01/08/06
Posts: 567

Profile Email    
  Quote
By: lgarner (offline)  Dec 10 2010 09:21 am  
lgarner

Calculated fields only show up in the results table since they haven't been calculated before the form is submitted. They'll also show up on the printable form that the admin can see. What you probably want is to create a printable copy of the form for the submitter's records type of thing. I've been thinking of how to add that while ensuring access for only anonymous users. Probably a simple expiration so the form won't be shown more than 5 minutes after submitting might work. Of course, the same calculations can be done after downloading the data, but this way the result can be shown in the results via an autotag. Maybe not too useful, but an interesting exercise to get working.

The calculated and static fields were requested, and I just added numeric for formatting. The format field works the same as for the calculated field (sorry, that tidbit didn't get into the help file). It also converts the input to a float type. Put in a sprintf()-compatible string to have the number formatted for display.

Forum Admin
Admin

Group Comfort
Level:
: +52

Registered: 06/10/08
Posts: 1914

Profile Email Website  
  Quote
By: Rocky (offline)  Dec 10 2010 23:41 pm  
Rocky

Thanks, Lee.

I found a bug.

Each time I edit a field, it's location shifts to the bottom, I have to change its location back to where I want it. This wasn't an issue previously.

I am still trying to figure out how to apply the calculation feature. Maybe I am getting old, my brain is not a sharp as usual on something I think should be obvious. I still don't know which fields to use to create a form for the scenario described in my previous posting.

Thanks!

Sam

Forum Active Member
Active Member

Group Comfort
Level:
: +5

Registered: 01/08/06
Posts: 567

Profile Email    
  Quote
By: lgarner (offline)  Dec 11 2010 00:40 am  
lgarner

For the form, you'd need several fields You could do something like this:

singles = No. of single rooms
totalsingles = calculated total amount of rooms. The type would be multiplication, and the value would be "singles,125" for $125/room.
doubles = No. of double rooms
totaldoubles = double room total. Value is "doubles,250" for $250/room.
Bus would be a text field, or you might be able to use a checkbox. Since the checkbox value is "1", it might work to have another multiplication field for "bus,50" for instance. Same for meal.

So now you'd have 4 calculated fields: totalsingles, totaldoubles, totalbus, and totalmeals. You create one more calculation, type "Addition" with a value of the 4 field names separated by commas. Remember that the submitter won't see the results, though. They'll just be part of the results table when viewed or downloaded by the admin.

There is some documentation of sorts, mostly notes to self, at http://www.leegarner.com/dokuwiki/doku. ... orms:start that might help.

Forum Admin
Admin

Group Comfort
Level:
: +52

Registered: 06/10/08
Posts: 1914

Profile Email Website  
  Quote
By: Rocky (offline)  Dec 16 2010 21:54 pm  
Rocky

Thanks Lee,

I will appreciate if you can fix that bug that I mentioned above too--Each time I edit a filed, it moves to the bottom instead of staying at the same place.

Thanks!

Sam

Forum Active Member
Active Member

Group Comfort
Level:
: +5

Registered: 01/08/06
Posts: 567

Profile Email    
  Quote
By: lgarner (offline)  Dec 17 2010 00:13 am  
lgarner

It's fixed for the next release. In the meantime you just need to select the field position in the dropdown list. Select "No Change" to have it stay put.

Forum Admin
Admin

Group Comfort
Level:
: +52

Registered: 06/10/08
Posts: 1914

Profile Email Website  
  Quote
By: Rocky (offline)  Dec 17 2010 19:25 pm  
Rocky

Since you are preparing to release the next version, please consider adding the following tweaks I have added to the codes to improve user friendliness.
1. Identifying the form ID needs to be made easy. I have added the ID field on the Form List at the beginning page of the Form Administration. The following line was added to admin/plugin/forms/index.php around line 365:

PHP Formatted Code

    $header_arr = array(
                array('text' => 'ID', 'field' => 'id', 'sort' => true), // Sam added
        array('text' => $LANG_ADMIN['edit'], 'field' => 'edit', 'sort' => false),
        array('text' => $LANG_ADMIN['copy'], 'field' => 'copy', 'sort' => false),
        array('text' => $LANG_FORMS['submissions'], 'field' => 'submissions', 'sort' => false),
        array('text' => $LANG_FORMS['name'], 'field' => 'name', 'sort' => true),
        array('text' => $LANG_FORMS['enabled'], 'field' => 'enabled', 'sort' => true),
        array('text' => 'Action', 'field' => 'action', 'sort' => true),
        array('text' => $LANG_ADMIN['delete'], 'field' => 'delete', 'sort' => false),
);
 


And the following change around line 528 in admin/plugin/forms/index.php

PHP Formatted Code

    case 'id':
        $retval = $A['id'];  // Sam edited
        break;
 


2. To help the admin get the URL quickly the URL to the form is added to the Form Preview page. The following lines are added to admin/plugin/forms/index.php around line 247:

PHP Formatted Code
 
case 'preview':
    $content .= FRM_adminMenu($view, 'hdr_form_preview');
    if ($frm_id > 0) {
        USES_forms_class_form();
        $F = new frmForm($frm_id);
        $T = new Template($_CONF['path'] . '/plugins/forms/templates/');
        $T->set_file('header', 'preview_header.thtml');
        $T->set_var('frm_name', $F->name);
                $T->set_var('frm_id', $frm_id); // Sam added
                $T->set_var('frm_link', FRM_PI_URL . '/index.php?frm_id=' . $frm_id); // Sam added
        $T->parse('output', 'header');
        $content .= $T->finish($T->get_var('output'));
        $content .= $F->Render('preview');
    }
    break;



And add the User URL line to the forms/templates/custom/preview_header.thtml

PHP Formatted Code

<h2>{$LANG_FORMS['preview']}: {frm_name} <br /></h2>
User URL: <a href="{frm_link}">{frm_link}</a>
 



3. The Radio button list is not aligning properly because of the unnecessary space “&nbsp;” So it is removed from line 473 of forms/classes/ field.class.php

PHP Formatted Code

            foreach ($values as $id=>$value) {
                $sel = $this->value == $value ? 'checked="checked"' : '';
                $fld .= "<input $class type=\"radio\" name=\"{$this->name}\"
                        id=\"{$this->name}\"
                        value=\"$value\" $sel $readonly>$value\n";  // Sam deleted space




Don't think that I know PHP. It took me hours to figure out these tweaks because I desperately needed to use this script for an event. I gave up on finding the "No Change" bug because according to editfield.thtml that should not happen.

Thanks!

Sam

Forum Active Member
Active Member

Group Comfort
Level:
: +5

Registered: 01/08/06
Posts: 567

Profile Email    
  Quote
By: Rocky (offline)  Dec 17 2010 19:33 pm  
Rocky

Another bug,

The "Span All Columns" check box for the "Static" field is not working as it is supposed to. If checked the entire text move to the left.

Another tweak I made is to the form.thtml around line 24, I added the style codes to make it appear neater:

PHP Formatted Code
  <td style="float:right; vertical-align:top; padding-top:3px;"



Thanks!

Sam

Forum Active Member
Active Member

Group Comfort
Level:
: +5

Registered: 01/08/06
Posts: 567

Profile Email    
  Quote
By: lgarner (offline)  Dec 17 2010 22:35 pm  
lgarner

Quote by: Rocky

Another bug,

The "Span All Columns" check box for the "Static" field is not working as it is supposed to. If checked the entire text move to the left.


It should shift to the left, but are you saying that it's showing *only* in the left column? That checkbox should add a 'colspan=2"' to the first column so it spans both.

[/QUOTE]Another tweak I made is to the form.thtml around line 24, I added the style codes to make it appear neater:

PHP Formatted Code
  <td style="float:right; vertical-align:top; padding-top:3px;"



Thanks!

Sam[/p][/QUOTE]

Cool, that's probably good, especially for textarea fields.

Forum Admin
Admin

Group Comfort
Level:
: +52

Registered: 06/10/08
Posts: 1914

Profile Email Website  
  Quote
By: Rocky (offline)  Dec 18 2010 08:19 am  
Rocky

Hi Lee,

Yes, when it is checked, the text move to the left and squeeze in the left column and doesn't span to the right.

Thanks!

Sam

Forum Active Member
Active Member

Group Comfort
Level:
: +5

Registered: 01/08/06
Posts: 567

Profile Email    
  Quote
By: lgarner (offline)  Dec 19 2010 14:46 pm  
lgarner

Thanks for the additions, I've added them. One thing- try taking out the "float:right" in the table cell. With that I was able to see the field squeezing into the left side.

I think what you were after is 'style="text-align:right;", but this is already handled by the 'class="alignright"' cell attribute (part of gFusion's stylesheets).

Forum Admin
Admin

Group Comfort
Level:
: +52

Registered: 06/10/08
Posts: 1914

Profile Email Website  
  Quote
By: Rocky (offline)  Dec 25 2010 08:14 am  
Rocky

Merry Christmas Lee,

There was a reason I had to replace that class=alignright with the local style, but can't think of it right now. I guess it doesn't alight top properly with the right column.

A feature request:

I have a form that barely went live and begin to get spam submissions already. I think it might need Capcha to go with it.

Thanks!

Sam

Forum Active Member
Active Member

Group Comfort
Level:
: +5

Registered: 01/08/06
Posts: 567

Profile Email    
  Quote
By: lgarner (offline)  Dec 25 2010 16:30 pm  
lgarner

Good idea. I'll add the captcha as an option (off, on, on for anonymous only).

Forum Admin
Admin

Group Comfort
Level:
: +52

Registered: 06/10/08
Posts: 1914

Profile Email Website  
  Quote
By: Manny (offline)  Jan 08 2011 11:06 am  
Manny

Yeah,

My site got hit with about a half dozen so captchahould help. Looking forward to the update.

The best gardens are made not by planting more flowers but by picking more weeds.


Forum Regular Member
Regular Member

Group Comfort
Level:
: +4

Registered: 03/07/08
Posts: 97
Location: PA

Profile Email    
  Quote
By: Rocky (offline)  Jan 13 2011 15:28 pm  
Rocky

Another feature might be helpful.

I received an email notification of a comment posted on my site by an anonymous person and it includes the IP address of the poster.

That reminds me of having this feature on the form plugin - to record poster's IP address along with the form data if you think it is a good idea.

Thanks!

Sam

Forum Active Member
Active Member

Group Comfort
Level:
: +5

Registered: 01/08/06
Posts: 567

Profile Email    
  Quote
New Topic Post Reply

First | Previous | 1 2 3 | Next | Last

 All times are CDT. The time is now 07:53 am.
Normal Topic Normal Topic
Locked Topic Locked Topic
Sticky Topic Sticky Topic
New Post New Post
Sticky Topic w/ New Post Sticky Topic w/ New Post
Locked Topic w/ New Post Locked Topic w/ New Post
View Anonymous Posts 
Able to Post 
HTML Allowed 
Censored Content