The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Validation help for a NooB (JS?)
I have created a form, and it is working great!
The only thing I would like to do is prevent duplicate text box entries for a certain field (empire_name)

The form is FormBuilder type, Published

For what I am reading I need to use the JS validation method?

How / Where do I make the changes?
I seem to be missing something, probably simple....


Still trying to figure this out...
baaah tool its great but support its very hard :S
it should be a premium support Tongue
Nelson Costa.
(May 1st, 2017, 1:02 PM)eris667 Wrote: Bump?

Is this a internal or external form.  If external, can you paste it here?  Remove any sensitive info of course.

Here's a snippet for a single field and what is required for a external form.  All the below is in a single .php file, but pruned to just show the minimum fields.

Registration Page

PHP Code:
$fields ft_api_init_form_page(2);

// validation time!
$errors = array();
if (isset(
   $rules = array();
    $rules[] = "required,firstname,Please enter your first name.";
    $rules[] = "letters_only,firstname,Please only use letters for your first name. *-No spaces/numbers/etc.";
    $errors validate_fields($_POST$rules);
// no errors - great! Now we process the page. The ft_api_process_form does
// the job of both updating the database and redirecting to the next page
   if (empty($errors))
       $params = array(
           "submit_button" => "sbmt",
            "next_page" => "",
            "form_data" => $_POST,
            "finalize" => true
// it failed validation. Update $fields with the latest contents of the form data
       $fields array_merge($_SESSION["form_tools_form"], $_POST);

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<title>Registration Form</title>
<link rel="stylesheet" type="text/css" href="registration.css">

// if $errors is not empty, the form must have failed one or more validation
// tests. Loop through each and display them on the page for the user
if (!empty($errors))
   echo "<div class='error'>Please fix the following errors:\n<ul>";
    foreach ($errors as $error)
    echo "<li>$error</li>\n";
    echo "</ul></div>";

<!-- Start of FORM -->
<div align="center">
<form action="<?php echo $_SERVER["PHP_SELF"]?>" method="POST">
  <table border="1" cellpadding="5" cellspacing="1" width="800">
      <tr align="center">
        <td colspan="2" rowspan="1" valign="top"> <h2>HEADER 2</h2></td>
      <tr align="center">
        <td rowspan="1" colspan="2" valign="top" width="618"><BIG><BIG><B>TITLE<br>
        <td align="right" valign="top" width="35%">First Name<br>
        <td valign="top" width="618"><input maxlength="30" size="30" type="text" name="firstname" value="<?=@$fields["firstname"]?>" /> *-Required</td>
        <td colspan="2" rowspan="1" valign="top">
        <div align="center">Please confirm everything is correct before you submit!<br><input name="sbmt" value="Submit/Validate Form" type="submit"> </div>
<!-- End of FORM -->

You'll have to read through the options for the different field types, but the above should give you a base page to start with.  Hopefully, I didn't bork anything up by removing too much for this example.


Forum Jump:

Users browsing this thread: 1 Guest(s)