Re: 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..
PHP Code:
// 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:
Code:
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 because someone with REAL coding skills might be able to use this information the way it's meant to be used.. :laugh:
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/del...ge=band_signup
PS O also dont need terms and conditions..
Re: custom forms - data collection
Quote:
Originally Posted by
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/del...ge=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)
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
HELP PLZ!!! on the last PART
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/del...ge=band_signup
:blink:
Re: HELP PLZ!!! on the last PART
Quote:
Originally Posted by
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/del...ge=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..)
Re: HELP PLZ!!! on the last PART
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:
Quote:
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
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
Re: HELP PLZ!!! on the last PART
Quote:
Originally Posted by
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):
Quote:
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:
Code:
require(DIR_WS_MODULES . 'require_languages.php');
$breadcrumb->add(NAVBAR_TITLE);
Hope that helps..
Re: HELP PLZ!!! on the last PART
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
Re: custom forms - data collection
Quote:
Originally Posted by
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.
Cliff
I 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!