Issue 203 in php-form-builder-class: Form Builder Class Submit Button - No Value

23 views
Skip to first unread message

php-form-bu...@googlecode.com

unread,
Aug 12, 2013, 3:15:23 AM8/12/13
to php-form-builder...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 203 by afnav...@gmail.com: Form Builder Class Submit Button - No
Value
http://code.google.com/p/php-form-builder-class/issues/detail?id=203

Hi, I'm having problem with the submit button cuz when I try to click the
it, it doesn't show its value in the $_POST.

I need it cuz there are instances that I would like the lines of code to
run only when the user clicks the submit Button.


I'm not able to do that at the moment.


--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

php-form-bu...@googlecode.com

unread,
Dec 27, 2013, 3:57:05 PM12/27/13
to php-form-builder...@googlegroups.com

Comment #1 on issue 203 by shamilto...@gmail.com: Form Builder Class Submit
It appears that a jQuery function disables all the submit buttons to
prevent duplicate submissions. I too would like to have multiple submit
buttons on a form and then test the return $_POST to work out which one was
submitted. If you comment out the lines 307 - 312 in Form.php your submit
variables are passed.

php-form-bu...@googlecode.com

unread,
Dec 27, 2013, 9:43:45 PM12/27/13
to php-form-builder...@googlegroups.com

Comment #2 on issue 203 by afnav...@gmail.com: Form Builder Class Submit
Yeah that's why I was forced to create my own form class with common error
checking. I didn't use google forms anymore. XDDDD

It's okay to not disable the the submit buttons cuz we can work around it
by giving them unique names within the same page so it wouldn't be a
problem. I don't know why they did that. I would have used google forms
over my latest project but because of this I stopped. I hope google would
resolve this one.

IMO, I think it would have been better if we include 1 file only in a
project so that I don't have to do more things other than including 1 class
file.

For example: it would have been better if it looks like this.

include "1class_file_for_a_form_class.php";

$form = new form();
$form->function_blah_blah(); //something like that... just saying :D

php-form-bu...@googlecode.com

unread,
Jun 18, 2014, 5:44:06 AM6/18/14
to php-form-builder...@googlegroups.com

Comment #3 on issue 203 by patrick....@gmail.com: Form Builder Class Submit
I also have similar problem. Is there an easy way to know which button is
pressed?
I have form with "New", "Save", "Delete", "Duplicate" buttons.

php-form-bu...@googlecode.com

unread,
Jun 26, 2014, 1:52:23 PM6/26/14
to php-form-builder...@googlegroups.com

Comment #4 on issue 203 by jhardgra...@gmail.com: Form Builder Class Submit
Here is a potential fix for the issue. Starts at line 307.

<code>
/*When the form is submitted, disable all submit buttons to prevent
duplicate submissions.*/
echo <<<JS
jQuery("#$id input[type=submit]").click(function() {
var submit_val = jQuery(this).val();
var submit_name = jQuery(this).attr("name").val();
jQuery('<input name="+submit_name+'" type="hidden"
value="'+submit_val+'">').insertAfter(this);
});

jQuery("#$id").bind("submit", function() {
jQuery(this).find("input[type=submit]").attr("disabled", "disabled");
});
JS;
</code>

php-form-bu...@googlecode.com

unread,
Jun 26, 2014, 1:54:04 PM6/26/14
to php-form-builder...@googlegroups.com

Comment #5 on issue 203 by jhardgra...@gmail.com: Form Builder Class Submit
Here the fix i found for the issue. It basically creates a hidden input
with the value from the clicked button, and still allows the button to be
disabled.

/*When the form is submitted, disable all submit buttons to prevent
duplicate submissions.*/
echo <<<JS
jQuery("#$id input[type=submit]").click(function() {
var submit_val = jQuery(this).val();
var submit_name = jQuery(this).attr("name").val();
jQuery('<input name="+submit_name+'" type="hidden"
value="'+submit_val+'">').insertAfter(this);
});

jQuery("#$id").bind("submit", function() {
jQuery(this).find("input[type=submit]").attr("disabled", "disabled");
});
JS;

php-form-bu...@googlecode.com

unread,
Jun 26, 2014, 1:55:04 PM6/26/14
to php-form-builder...@googlegroups.com

Comment #6 on issue 203 by jhardgra...@gmail.com: Form Builder Class Submit
Here the fix i created for the issue. (feel free to modify for your needs)

php-form-bu...@googlecode.com

unread,
Jun 26, 2014, 2:00:11 PM6/26/14
to php-form-builder...@googlegroups.com

Comment #7 on issue 203 by jhardgra...@gmail.com: Form Builder Class Submit
Button - No Value
http://code.google.com/p/php-form-builder-class/issues/detail?id=203

Here the fix i created for the issue. (feel free to modify for your needs)
It basically creates a hidden input with the value from the clicked button,
and still allows the button to be disabled.

/*When the form is submitted, disable all submit buttons to prevent
duplicate submissions.*/
echo <<<JS
jQuery("#$id input[type=submit]").click(function() {
var submit_val = jQuery(this).val();
var submit_name = jQuery(this).attr("name");

php-form-bu...@googlecode.com

unread,
Dec 24, 2014, 9:17:59 AM12/24/14
to php-form-builder...@googlegroups.com

Comment #8 on issue 203 by rudrapa...@gmail.com: Form Builder Class Submit
Button - No Value
https://code.google.com/p/php-form-builder-class/issues/detail?id=203

Notice: Undefined index: name in C:\xampp\htdocs\afnokaam\submit.php on
line 4
Reply all
Reply to author
Forward
0 new messages