PHP Classes

How can i submit the inputs to another script?

Recommend this page to a friend!

      PHP Forms Class with HTML Generator and JavaScript Validation  >  PHP Forms Class with HTML Generator and JavaScript Validation package blog  >  How to Show Google Ma...  >  All threads  >  How can i submit the inputs to...  >  (Un) Subscribe thread alerts  
Subject:How can i submit the inputs to...
Summary:How can i submit the inputs to another script?
Messages:11
Author:Steffen Zweiniger
Date:2008-11-09 16:59:42
Update:2009-01-17 23:29:30
 
  1 - 10   11 - 11  

  1. How can i submit the inputs to...   Reply   Report abuse  
Picture of Steffen Zweiniger Steffen Zweiniger - 2008-11-09 16:59:42
Hi,

for the first: Its a great class.
But now i have a problemm. I developed my form, and it works fine.

I set the following variable $form->ACTION=""; and all the inputs where validated and the form is shown again with my inputs. Now i just wanted to submit the inputs to another script to store them in my database. so i set $form->ACTION="store.php"; .
Whats happening is, the inputs where passed to the store.php, but there is no more validation.

How can i fix this?

I will appreciate for any help.


  2. Re: How can i submit the inputs to...   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2008-11-09 17:21:58 - In reply to message 1 from Steffen Zweiniger
That is why you should present, validate and process the form in the same script.

You do not need to post the form to separate script. Just include your store.php script in your form script where you check whether the form was submitted and validated.

  3. Re: How can i submit the inputs to...   Reply   Report abuse  
Picture of Steffen Zweiniger Steffen Zweiniger - 2008-11-10 04:03:53 - In reply to message 2 from Manuel Lemos
Thanks very much for your fast reply.

I've done this an it works, but there is another problem.

My form contains two date fields generated by the date-class. In my case is this a startdate and the enddate of an event. Its neccesary for me to operate with this dates and validate them, for example between these date must be a range of min. 3 days.
When i select the dates the form them, and in case they are valid dates the form goes ahead.
But i cant check if my two dates have the needed space.
Yes, i can do this check when the form is submitted. But if my validation fails i cannot use the Backbutton, because all the inputs are lost.

So are my questions:

Is there a way to operate with the dates or validate them in more ways before i submit the form (like all other validations)?

Is there a way to avoid that my inputs are lost when the form needs to be loaded again?

Thanks again, i will say a prayer for you...


  4. Re: How can i submit the inputs to...   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2008-11-10 05:28:59 - In reply to message 3 from Steffen Zweiniger
You need to use a custom validation class. Take a look at the test_custom_validation.php script.

If the form has invalid fields you just need to present the form again tothe user instead of processing it.

  5. Re: How can i submit the inputs to...   Reply   Report abuse  
Picture of Steffen Zweiniger Steffen Zweiniger - 2008-11-17 13:17:45 - In reply to message 4 from Manuel Lemos
Thanks,

ok itried to use this for my special validation. But i cnat get i work.

Ok, when i try to verify one input and compare it to a given value, it works.

But i wrote there is the range between the two dates. I can pass the input values of the date-fields to the custom validation file. I can calculate the range between the dates from the input values within the custom validation file.
But the client-validation fails in Firefox, but the Server valiadtion works and validates.
In IE and Chrome i can press the send button, he's gonna disabled and nothing happens. So i think its a problem of the generated javasript, but i cant find out. The values in the javascript seems to be right, but i think there is a problem while the result of the datecalculation is not an input value. Could this be?

As previously mentioned, other simple validations do it, but here i give up.

May i send you the files or publish them here?

  6. Re: How can i submit the inputs to...   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2008-11-18 00:11:47 - In reply to message 5 from Steffen Zweiniger
Sure, if the files are small, you can publish here. Otherwise please paste them in a pastebin site.

Make sure you provide both the custom validation class and the example script code.

  7. Re: How can i submit the inputs to...   Reply   Report abuse  
Picture of Steffen Zweiniger Steffen Zweiniger - 2008-11-18 06:09:48 - In reply to message 6 from Manuel Lemos
Thats great. Thank you.

Here the file for the form: http://pastie.org/pastes/317574

and the custom validation: http://pastie.org/pastes/317576

and this is the output: http://pastie.org/pastes/317580

I left the sample custom validation in the file, and it works.

I know the code is no well formatted and its a product of trail and error :-)

Thank your very much for your help.

  8. Re: How can i submit the inputs to...   Reply   Report abuse  
Picture of Steffen Zweiniger Steffen Zweiniger - 2008-11-29 01:36:05 - In reply to message 7 from Steffen Zweiniger
Ok, no answer. Pity.

However, it works now, but dont know why. The validation error does not appear in the js-alert box. But at the end of all 'normal' validations, it ist displayed above the form. That does it for my demands.

But there is a last problem. I have a field with the validation of an lower and an upper limit. The low limit is fix, but the upper limit varies and comes from the database.

$mylimit = 'get var from database.......';

$form->AddInput(array(
"TYPE"=>"text",
"NAME"=>"count",
"ID"=>"count",
"ValidateAsInteger"=>1,
"ValidationLowerLimit"=>1,
"ValidationUpperLimit"=>$mylimit,
"ValidationErrorMessage"=>"Invalid Count",
"ACCESSKEY"=>"C"
));

But this doesnt work.

How can i get this working?

  9. Re: How can i submit the inputs to...   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2008-12-03 21:26:03 - In reply to message 7 from Steffen Zweiniger
Sorry for the delay. I have been very busy lately.

The problem is that your Javascript code has syntax errors and that prevents the client side validation to be executed.

I suggest that you use Firefox for instance with the Firebug extension so you can easily see and fix the Javascript syntax errors.

  10. Re: How can i submit the inputs to...   Reply   Report abuse  
Picture of Steffen Zweiniger Steffen Zweiniger - 2009-01-17 22:50:04 - In reply to message 9 from Manuel Lemos
Thank you very much for your replys above. I took a long time but now i could solve everything, excepting one problem.

I use the date valiadtion class among other things for the input for an Credit Card expiration date. I dont wanna use a normal input field for this, mostly you have to describe how the dateformat should be an so on.
I want to use the normal date select field, but its common to input only month and year for this.
But it seems there is no way to do that with the normal date validation, or is it?
So my question: Can i generate a custom date field only with month an year without making a custom validation only by using the date validation class?

Thanks for your help

Steffen

 
  1 - 10   11 - 11