Datacheck by user before form is send?

Roxxinger 31 Aug, 2007
hello

i have a form with javascript validation, so i filled the form tag attachment with onsubmit="return checkform(this);"
form html and form javascript and email template a filled with some code, works everthing fine.

now before the form is send per email a new site with all the data should be visible so that the user must read through it an then klick on a button send and now the form should be send not earlier.

i think i must do i with On Submit code - before sending email:
but i tried a simple php script there an it doesn´t worked.
Dear, <?php echo $_POST['vname']." ".$_POST['nname']; ?>


what do i miss? can someone help me?
GreyHead 31 Aug, 2007
Hi Roxxinger,

I'm not completely sure what you are trying to do. The 'OnSubmit code before' won't stop the email being sent.

Is the sequence like this?

1) Display the form

2) When a valid form is submitted, then display the data on a new form and ask for confirmation

3) When confirmed, send the email.

Really you need to show a second form for the confirmation and the problem is to pass the data to this second form. I don't believe that you can do this at present without hacking the code. It is a similar problem to the one we looked at in this thread on server side validation.

If you make those small changes to the code then you could add all your results to the $validate array and then recall the same form.

The form code would need to look like this:
<?php
if ( !$validate || empty($validate) ) {
?>
  . . . main form code here . . .
<?php } else { ?>
  . . .  confirmation form code here . . . 
<?php } ?>
and the 'OnSubmit - before' code like this
 <?php
if ( !$validate || empty($validate) ) {
  $validate['name1'] = $_POST['name1'];
  . . .
  $validate['name99'] = $_POST['name99'];
  showform();
}
?>
Caution: not tested - probably needs debugging!!

Bob

Edited to fix a broken tag<br><br>Post edited by: GreyHead, at: 2007/08/31 14:20
Roxxinger 31 Aug, 2007
yes thats what i wanted to try...hm i dont realy want du hack😟
GreyHead 31 Aug, 2007
Hi Roxxinger,

Max may have a better idea when he logs in.

The hack is very simple, I can post the amended files if that would be helpful.

Bob
Max_admin 31 Aug, 2007
Hi Roxxinger,

I guess you want to show the user the data he/she entered to confirm it then when he click submit on this page it will be sent, is that right ?

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Roxxinger 31 Aug, 2007

Hi Roxxinger,

I guess you want to show the user the data he/she entered to confirm it then when he click submit on this page it will be sent, is that right ?

Max



yes thats right🙂
Max_admin 01 Sep, 2007
Cool, lets assumed we have 2 fields only at the form, name and email

Create another form then put the new form URL in the action URL of the first one.

Now, in the new form HTML box, write this code :


You have entered the following data :
Name : <?php echo $_POST['name']; ?><input type="hidden" name="name" value="<?php echo $_POST['name']; ?>">
Email : <?php echo $_POST['email']; ?><input type="hidden" name="email" value="<?php echo $_POST['email']; ?>">
<input type="submit" value="Confirm">


then just make the 2nd form to email results wherever you may like!!

If you have a long list of fields then consider this code too :


You have entered the following data :
<?php foreach($_POST as $key => $val){ ?>
<?php echo $key; ?> : <?php echo $val; ?><input type="hidden" name="<?php echo $key; ?>" value="<?php echo $val; ?>">
<?php } ?>
<input type="submit" value="Confirm">


Cheers

Max<br><br>Post edited by: admin, at: 2007/08/31 21:36
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Roxxinger 07 Sep, 2007
ah ok i will try it...with action url u mean then Form tag attachment: or? so i would give up my javascript which i could perform in the new form?

jan
Max_admin 13 Sep, 2007
Hi Jan,

No, there is a field for the action URL only!!

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Roxxinger 17 Sep, 2007
ah ok found it and tested it but it appeared an error
Parse error: parse error, unexpected T_ECHO in ..\components\com_chronocontact\chronocontact.html.php(46) : eval()'d code on line 4


i enterd the action url of the new form like
index.php?option=com_chronocontact&chronoformname=formname


is that correct? am i missing somehting else?

jan

Post edited by: Roxxinger, at: 2007/09/17 14:06<br><br>Post edited by: Roxxinger, at: 2007/09/17 14:07
Roxxinger 17 Sep, 2007
ah the code which loads the variable automaticly doesnt workes the other one works fine
Max_admin 17 Sep, 2007
Hi Jan,

The 2 code pieces I posted earlier just do the same thing but the 2nd piece can be used if you have too many fields to send and dont like to write them all in your code, please try them both, they should work bot, take care that the word "<?php" doesnt get splitted across 2 lines.

Now regarding the URL, the first form action URL should be the URL of the 2nd from, so assuming you have 2 forms, form1 and from2, the action URL of form1 should be :
index.php?option=com_chronocontact&chronoformname=form2

Please let me know how it goes.

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Roxxinger 17 Sep, 2007
yep i played a little with the code and now it works everthing very fine, thank u very much😀
Max_admin 18 Sep, 2007
Great news, glad it works now!!🙂

Best regards,

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.