Zen Cart Logo
Forums / All Other Contributions/Addons / custom forms - data collection

custom forms - data collection

Sticky

Views: 221,970

Results 141 to 160 of 259
27 Jun 2009, 5:08 AM
#141
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

custom forms - data collection

Well I may have been confused by the array section of this code, but I understood enough of this post to figure out how to adapt the validation portion of this code for my own form's dropdowns..

// do you want to set a default selection?  if not, use '0':
$default_pulldown_selection = '2';

//For validation, you're looking for the contents of the $_POST['my_pulldown_menu'] variable
// this is only set after "submit" is clicked.
$pulldown_selected_item = (isset($_POST['my_pulldown_menu'])) ? $_POST['my_pulldown_menu'] : $default_pulldown_selection ;


//build an array of entries to be displayed on the template:
    $pulldown_contents[] = array('id'=>'0', 'text'=>'Please Select');
    $pulldown_contents[] = array('id'=>'1', 'text'=>'Choice Number 1');
    $pulldown_contents[] = array('id'=>'2', 'text'=>'Choice Number 2');
    $pulldown_contents[] = array('id'=>'3', 'text'=>'Choice Number 3');
    $pulldown_contents[] = array('id'=>'4', 'text'=>'Choice Number 4');
    $pulldown_contents[] = array('id'=>'5', 'text'=>'Choice Number 5');


// you could add some validation here.
if ($pulldown_selected_item==0) { 
  $messageStack->add_session('header','Please select an option from the pulldown menu','error');
}

From this I added the following to my own form handler:

if ($question4==0) { 
  $error = true;
  $messageStack->add('customer_questionnaire','Do you prefer virgin hair?: Please select an option from the pulldown menu');
}  
if ($question5==0) { 
  $error = true;
  $messageStack->add('customer_questionnaire','Have you had experience with premium hair?: Please select an option from the pulldown menu');
}  
```I've seen the question on how to add dropdowns in this thread a bit.. So I wanted to share what I did in case it is of use to someone else.

Plus I also wanted to share the rest of the code posted [here](http://www.zen-cart.com/forum/showpost.php?p=212034&postcount=2) because someone with REAL coding skills might be able to use this information the way it's meant to be used.. :laugh:
23 Jul 2009, 7:50 PM
#142
orange_wacko avatar

orange_wacko

New Zenner

Join Date:
Jul 2009
Posts:
21
Plugin Contributions:
0

Re: custom forms - data collection

Hey I just downloaded the mode, and I have been trying to figure out what went wrong. Basically all I needed was the name, Email, mailing address, city, zip code and order description. Anyways, I have went thru the tpl_Band_signup_default,php file and removed all the code that gathered information I didnt need. Well, then for my page (Local Orders) using EZ pages I have set up "index.php?main_page=band_signup"

Well the form shows up on that page, when I fill it up though it shos me whole bunch of errors about the required fields I have st up. Bascially why does it still follow those fields if i deleted them and how can I fix this problem?

Also, why this band mode doesnt show up in "define pages"??

:frusty:

thanks!

here is the link:
http://www.stephenmendenhall.com/delete_me/index.php?main_page=band_signup

PS O also dont need terms and conditions..

24 Jul 2009, 12:29 AM
#143
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: custom forms - data collection

Orange Wacko:

Hey I just downloaded the mode, and I have been trying to figure out what went wrong. Basically all I needed was the name, Email, mailing address, city, zip code and order description. Anyways, I have went thru the tpl_Band_signup_default,php file and removed all the code that gathered information I didnt need. Well, then for my page (Local Orders) using EZ pages I have set up "index.php?main_page=band_signup"

Well the form shows up on that page, when I fill it up though it shos me whole bunch of errors about the required fields I have st up. Bascially why does it still follow those fields if i deleted them and how can I fix this problem?

Also, why this band mode doesnt show up in "define pages"??

:frusty:

thanks!

here is the link:
http://www.stephenmendenhall.com/delete_me/index.php?main_page=band_signup

PS O also dont need terms and conditions..You removed the fields form the form, but failed to remove corresponding validation entries from the form handler script.. (hence the errors)

24 Jul 2009, 7:43 PM
#144
orange_wacko avatar

orange_wacko

New Zenner

Join Date:
Jul 2009
Posts:
21
Plugin Contributions:
0

Re: custom forms - data collection

Okay I figured out that i need to look at header_php.php and try to find whatever fields I have removed. But my other question is how is it possible to actually add content to the band form? You know I though that it was possible with Define Pages from admin, but my panel doesn't show define band_signup.

All i want is to put some description and few pictures that will go with this form, and obviously make it work))

thanks

27 Jul 2009, 7:13 PM
#145
orange_wacko avatar

orange_wacko

New Zenner

Join Date:
Jul 2009
Posts:
21
Plugin Contributions:
0

Re: custom forms - data collection

Okay :shocking: I am on red DEADline .. ehh Please help me with the last part, prolly (I hope the easiest)-customization..

I got the form working! The link below. All I need now is to be able to add additional content to the form page. I want to know what I have to do to use the Define Pages feature. Because I DO NOT see my band_signup mod anywhere in admin, it doesnt show up.. I just want to put a short guides on how to fill my form and put 3 screenshots of the Local Orders deals. :wacko:

I thought my admin would recognize this additional mode and see it in the Define Pages Editor, i guess not?

Appreciate any help

http://www.stephenmendenhall.com/delete_me/index.php?main_page=band_signup

:blink:

1 Aug 2009, 10:46 PM
#146
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: custom forms - data collection

Orange Wacko:

Okay :shocking: I am on red DEADline .. ehh Please help me with the last part, prolly (I hope the easiest)-customization..

I got the form working! The link below. All I need now is to be able to add additional content to the form page. I want to know what I have to do to use the Define Pages feature. Because I DO NOT see my band_signup mod anywhere in admin, it doesnt show up.. I just want to put a short guides on how to fill my form and put 3 screenshots of the Local Orders deals. :wacko:

I thought my admin would recognize this additional mode and see it in the Define Pages Editor, i guess not?

Appreciate any help

http://www.stephenmendenhall.com/delete_me/index.php?main_page=band_signup

:blink:Add the content you want to the form you created.. Also, you might consider changing the name of the form to something other than band_signup (since it is not in fact a band signup form..)

13 Aug 2009, 3:05 PM
#147
cliffvt avatar

cliffvt

Zen Follower

Join Date:
Jul 2009
Posts:
100
Plugin Contributions:
0

Re: custom forms - data collection

Hello All

I used the "specialorder" template together with the suggested CAPTCHA code and built a stunning form, but alas, it wouldn't work, not even getting to the breadcrumb!. After hours of painstaking work, I found the error to be in the CAPTCHA code at the beginning of header_php - the code suggested in this post to use is:

Just after: ["require(DIR_WS_MODULES . 'require_languages.php');"
$breadcrumb->add(NAVBAR_TITLE);]
// BOF Captcha
if(CAPTCHA_CONTACT_US != 'false') {
require(DIR_WS_CLASSES . 'captcha.php');
$captcha = new captcha();
}
// EOF CaptchaWhen I comment this whole piece out, my form works like a dream. Anyone have any idea what's wrong with the CAPTCHA code?

Cheers

Cliff

13 Aug 2009, 4:03 PM
#148
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: custom forms - data collection

cliffvt:

Hello All

I used the "specialorder" template together with the suggested CAPTCHA code and built a stunning form, but alas, it wouldn't work, not even getting to the breadcrumb!. After hours of painstaking work, I found the error to be in the CAPTCHA code at the beginning of header_php - the code suggested in this post to use is:
When I comment this whole piece out, my form works like a dream. Anyone have any idea what's wrong with the CAPTCHA code?

Cheers

Cliff
Not trying to be a smart a$$, but you should clarify what you mean by "it wouldn't work". What didn't work?? the whole form?? just the CAPTCHA?? Both??

That said the only thing that stands out for me in your post is this (highlighted in red):

Just after: ["require(DIR_WS_MODULES . 'require_languages.php');"
$breadcrumb->add(NAVBAR_TITLE);]
// BOF Captcha
if(CAPTCHA_CONTACT_US != 'false') {
require(DIR_WS_CLASSES . 'captcha.php');
$captcha = new captcha();
}
// EOF Captcha
If the characters I highlighted are in your header_php.php code, then that is DEFINITELY an issue..

Here's the code from in my original post. Those lines in your header_php.php should look like this:

  require(DIR_WS_MODULES . 'require_languages.php');
  $breadcrumb->add(NAVBAR_TITLE);

Hope that helps..

13 Aug 2009, 4:10 PM
#149
cliffvt avatar

cliffvt

Zen Follower

Join Date:
Jul 2009
Posts:
100
Plugin Contributions:
0

Re: custom forms - data collection

Sorry, I should learn to express myself properly!

What I meant is that the form fails to load completely - I just get presented with a completely blank screen, and even when I select "View Source" from my browser, it's completely blank. As soon as I comment out the Captcha script, the form loads and validates fine upon submission.

The "[" brackets in my post was just to indicate where I pasted the captcha code after. The actual code in the PHP is correct.

However, since my post I've realised that I don't have any captcha installed - I just assumed that it was part of the standard Zencart install. I have now downloaded "captcha_using_ttf_gd_2-9.zip" and am in the process of installing this. I suspect that this may fix the problem. Will let you know if it doesn't.

Thanks for responding though - much appreciated.

Cliff

13 Aug 2009, 4:17 PM
#150
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: custom forms - data collection

cliffvt:

Sorry, I should learn to express myself properly!

What I meant is that the form fails to load completely - I just get presented with a completely blank screen, and even when I select "View Source" from my browser, it's completely blank. As soon as I comment out the Captcha script, the form loads and validates fine upon submission.

The "[" brackets in my post was just to indicate where I pasted the captcha code after. The actual code in the PHP is correct.

However, since my post I've realised that I don't have any captcha installed - I just assumed that it was part of the standard Zencart install. I have now downloaded "captcha_using_ttf_gd_2-9.zip" and am in the process of installing this. I suspect that this may fix the problem. Will let you know if it doesn't.

Thanks for responding though - much appreciated.

CliffI should learn to express myself too..:laugh: It never ocurred to me to ask if you had the CAPTCHA add-on installed.. (duh!) :laugh::laugh:

I believe in my post on how to add the CAPTCHA code I included a linkto the add-on too, but lemme go look.. I may need to re-post and clarify things a bit..

As soon as you install the CAPTCHA add-on, life should be good for you again!:smile: Would love to see the final result!

13 Aug 2009, 6:22 PM
#151
cliffvt avatar

cliffvt

Zen Follower

Join Date:
Jul 2009
Posts:
100
Plugin Contributions:
0

Re: custom forms - data collection

Diva, on an aside matter, do you have any idea where I can find some code for allowing the "manufacturer" in this instance to also upload a file together with the form? I think the one I found in the forum only works with attributes on the product selection screens...

Thanks a lot

Cliff

13 Aug 2009, 9:31 PM
#152
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: custom forms - data collection

cliffvt:

Diva, on an aside matter, do you have any idea where I can find some code for allowing the "manufacturer" in this instance to also upload a file together with the form? I think the one I found in the forum only works with attributes on the product selection screens...

Thanks a lot

CliffI did a half a$$ed search for something like that a while back and had no luck..:laugh:

My suggestion is to investigate the commercial section here or Rent-a-Coders.. (I've had good success with both) I am working with a coder now on two custom forms.. I had to have these created because of the somehwhat complex validation in both forms.. (which was beyond my skillset to create even using the band_signup zipfile as a template)

14 Aug 2009, 10:16 AM
#153
cliffvt avatar

cliffvt

Zen Follower

Join Date:
Jul 2009
Posts:
100
Plugin Contributions:
0

Re: custom forms - data collection

Diva hope you're good today!! Yes, you guessed it, today I am struggling with "pull_down menus" - implemented this suggested code, but on the form it displays a blank drop-down menu. If I leave all fields blank and then press "Submit" , as expected, it brings up errors for all the other fields, NOT the drop-down one, but viola!, the pulldown field is magically populated. Any ideas on what I am doing wrong here, seeing that you've mastered it?

here is my code:

HEADER_PHP:

// Pulldown to select a country
// Set default selection:
$default_pulldown_selection = '0';

//For validation, you're looking for the contents of the $_POST['choir_country'] variable
// this is only set after "submit" is clicked.
$pulldown_selected_item = (isset($_POST['choir_country'])) ? $_POST['choir_country'] : $default_pulldown_selection ;

//build an array of entries to be displayed on the template for field 'choir_country':
$pulldown_contents[] = array('id'=>'0', 'text'=>'Please Select');
$pulldown_contents[] = array('id'=>'1', 'text'=>'England');
$pulldown_contents[] = array('id'=>'2', 'text'=>'Wales');
$pulldown_contents[] = array('id'=>'3', 'text'=>'Scotland');
$pulldown_contents[] = array('id'=>'4', 'text'=>'Northern Ireland');

// Validation for the 'choir_country' selected field here.
if ($pulldown_selected_item==0) {
$messageStack->add_session('header','You must select a country, please','error');
}TEMPLATE:
<label class="inputLabel" for="choir_country">Which country are you in?:</label>

<?php echo zen_draw_pull_down_menu('choir_country', $pulldown_contents, $pulldown_selected_item); ?>

<br class="clearBoth" />Any ideas at all?

Cheers

Cliff

14 Aug 2009, 10:31 AM
#154
cliffvt avatar

cliffvt

Zen Follower

Join Date:
Jul 2009
Posts:
100
Plugin Contributions:
0

Re: custom forms - data collection

I figured out that the pulldown field contents are only generated AFTER the submit button is pressed. Any ideas how it could be generated BEFORE the submit button is pressed, i.e. on first display of the form?

Thanks

Cliff

14 Aug 2009, 10:43 AM
#155
cliffvt avatar

cliffvt

Zen Follower

Join Date:
Jul 2009
Posts:
100
Plugin Contributions:
0

Re: custom forms - data collection

All

Please pardon my stupidity. I have figured it out now and its sorted. :) It's all about WHERE I place the code for this - it should be placed BEFORE the "if (isset($_GET['action']) && ($_GET['action'] == 'send'))" line in the form handler file to work propely. I placed it after that. duh!!

Hope this helps other newbies too!

Cheers

Cliff

14 Aug 2009, 6:27 PM
#156
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: custom forms - data collection

Good Morning Cliff..

:laugh::laugh:I have had a good laugh reading your dropdown field evolution..:laugh::laugh:

All I had mastered was the dropdown field validation so that the "Select One" value errored out if selected.. It looks like you figured out how to get the dropdown field to populate with the array from the header_php file.. (that was the part that STUMPED me..):clap::clap:

27 Aug 2009, 1:18 PM
#157
joudesign avatar

joudesign

New Zenner

Join Date:
Jan 2009
Posts:
48
Plugin Contributions:
0

Re: custom forms - data collection

Hello

Drbyte

thank you very much for the module:
http://www.zen-cart.com/forum/showpost.php?p=386482&postcount=72

It was very useful

I added many pages using it and it works, but sudenly after the form is sent I have a blank white page, I have no clue why??

my page is:
http://jeshop.ma/index.php?main_page=band_signup

after i send i get white page:
http://jeshop.ma/index.php?main_page=band_signup&action=send

Your help is very apprciated

28 Aug 2009, 9:48 AM
#159
joudesign avatar

joudesign

New Zenner

Join Date:
Jan 2009
Posts:
48
Plugin Contributions:
0

Re: custom forms - data collection

Thank you drByte

I tried that but no clue

I re - installed a new band-signup files and I get the blank page

when i show the errors, when i press send button, I get:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/jeshop/public_html/includes/local/configure.php:1) in /home/jeshop/public_html/includes/functions/sessions.php on line 108

Notice: Constant OFFICE_IP_TO_HOST_ADDRESS already defined in /home/jeshop/public_html/includes/languages/french/email_extras.php on line 56

Notice: Constant OTHER_IMAGE_ already defined in /home/jeshop/public_html/includes/languages/french/other_images_names.php on line 35

Notice: Constant OTHER_IMAGE_ already defined in /home/jeshop/public_html/includes/languages/french/other_images_names.php on line 36

Notice: Constant OTHER_IMAGE_ already defined in /home/jeshop/public_html/includes/languages/french/other_images_names.php on line 37

Notice: Constant OTHER_IMAGE_ already defined in /home/jeshop/public_html/includes/languages/french/other_images_names.php on line 38

Notice: Constant BUTTON_IMAGE_GOTO_PROD_DETAILS already defined in /home/jeshop/public_html/includes/languages/french/other_images_names.php on line 44

Notice: Constant BUTTON_GOTO_PROD_DETAILS_ALT already defined in /home/jeshop/public_html/includes/languages/french/other_images_names.php on line 68

Warning: Cannot modify header information - headers already sent by (output started at /home/jeshop/public_html/includes/local/configure.php:1) in /home/jeshop/public_html/includes/init_includes/init_templates.php on line 78

Notice: Constant HEADING_TITLE already defined in /home/jeshop/public_html/includes/languages/french/band_signup.php on line 23

Notice: Undefined variable: email_text in /home/jeshop/public_html/includes/modules/pages/band_signup/header_php.php on line 194

Notice: Undefined index: EMAIL_TO_NAME in /home/jeshop/public_html/includes/functions/functions_email.php on line 83

Notice: Undefined index: EMAIL_TO_ADDRESS in /home/jeshop/public_html/includes/functions/functions_email.php on line 84

Notice: Undefined index: EMAIL_SUBJECT in /home/jeshop/public_html/includes/functions/functions_email.php on line 85

Notice: Undefined index: EMAIL_FROM_NAME in /home/jeshop/public_html/includes/functions/functions_email.php on line 86

Notice: Undefined index: EMAIL_FROM_ADDRESS in /home/jeshop/public_html/includes/functions/functions_email.php on line 87

Notice: Undefined variable: email_reply_to_address in /home/jeshop/public_html/includes/functions/functions_email.php on line 219

Notice: Undefined variable: email_reply_to_name in /home/jeshop/public_html/includes/functions/functions_email.php on line 220

Warning: Cannot modify header information - headers already sent by (output started at /home/jeshop/public_html/includes/local/configure.php:1) in /home/jeshop/public_html/includes/functions/functions_general.php on line 44


Your help is appreciated , it was working and I have no clue what caused this

29 Aug 2009, 8:46 AM
#160
joudesign avatar

joudesign

New Zenner

Join Date:
Jan 2009
Posts:
48
Plugin Contributions:
0

Re: custom forms - data collection

any help plz?