Forum Replies Created
- AuthorPosts
rubyj
ParticipantI just updated to the latest version of Avada, I think that solved the problem. The forms are showing up now. Thanks!
rubyj
ParticipantI am actually having this very same problem – the form doesn’t load for me to edit it. I am running the latest version of Avada and have everything else up to date as well. I’ve disabled the Combine CSS and Combine JavaScript options, but that didn’t work. Any other suggestions?
Thank you!
rubyj
ParticipantNevermind, I figured out a solution – I put everything into a custom template and ran it that way and it all works, I even got the form to display if my first condition was true. 🙂
I do wonder though why the php plugin was interfering.
rubyj
ParticipantUnfortunately, this didn’t end up working for me and we couldn’t find the error 🙁
I had to make the form from scratch in HTML and add javasript validators for each field and write a PHP back-end with the same functions to check records and insert where necessary.
It would be great if you could add such features in your next update where there would be options to check the records to see if one exists already.
Thanks-
rubyj
ParticipantThis code makes complete logical sense when I look at it and I’ve replaced all the dummy names with my database information, but it seems to not want to work. It gives me an error message of “An error occurred submitting the form” every time I submit.
Thinking that perhaps accessing the database was confusing the plugin (once from the code above, and once from the backend database inputs), I deleted all database info so that nothing was being saved directly from the plugin. This didn’t make any difference.
Any thoughts on what may be causing the problem?
Thanks again, you have been a huge help.
rubyj
ParticipantThis is perfect, thank you so much!!!
rubyj
ParticipantIn case it helps, here is the raw SQL query that illustrates what I’m trying to do:
INSERT INTO customer_suites( firstName, lastName, emailAddress )
SELECT *
FROM (SELECT upper( '$fname' ) , upper( '$lname' ) , upper( '$email' )
) AS tmp
WHERE NOT
EXISTS (SELECT *
FROM customer_suites
WHERE upper( firstName ) = upper( '$fname' )
AND upper( lastName ) = upper( '$lname' )
AND upper( emailAddress ) = upper( '$email' )
)
LIMIT 1
rubyj
ParticipantOk, so I will pull the value of the what the user submitted from the $code variable you have defined above. How do I reference the database to see if those values already exist?
Let’s say these are my variables for the fields that need validation that the user is submitting:
$fname = $element->getForm()->getValue('iphorm_7_1');
$lname = $element->getForm()->getValue('iphorm_7_2');
$email= $element->getForm()->getValue('iphorm_7_4');
Then would my code look like this?
function mytheme_custom_validator($valid, $value, $element)
{
if ($value = '$fname' and $value = '$lname' and $value = '$email') {
$element->addError('You have already registered for an account');
$valid = false; //no record will be added to the database
}
else
{
mysqli_query($con,"INSERT INTO database_name (firstName, lastName, emailAddress)
VALUES ('$fname', '$lname',$email)");
echo 'Welcome to our website, thanks for registering'; //record will be added to database
}
return $valid;
}
I want to prevent data from being inserted into the database if a record with the same values already exist. Would the above code accomplish this?
Thanks for all your help.
rubyj
ParticipantAnd another question – The guide used to alter the letters to uppercase uses the unique ID of the form element. For the hidden elements that I have created, I see no unique ID.
This is how I’ve adapted the code; basically I’ve replaced the uppercase string with the string that returns the first character in uppercase. But I do need an ID for the 5th line where you see the question marks. Or, how do I adapt without the unique ID for the hidden field?
function get_first_characters ($form)
{
//Return the first letter of the first name
if (isset($_POST['iphorm_7_1'])) {
$_POST['iphorm_7_??'] = ucfirst($_POST['iphorm_7_1']);
}
}add_action('iphorm_pre_process_7', 'get_first_characters');
Thanks.
rubyj
ParticipantHi Ally,
Thanks so much for your help! I was able to get the email confirmation field in there without any problems and am still working on the other issue.
Had another question though – When the user submits the form, I want there to be a query to the database to see if there is already an entry with the same first name, last name, and phone number. So far I feel like the easiest way to do this would be to run a php function upon submit, like you see below:
<form action="welcome.php" method="post">
Name: <input type="text" name="fname">
Age: <input type="text" name="age">
<input type="submit">
</form>
You see the form action is welcome.php. How do I attach an action to the submit button in Quform?
Thanks again-
rubyj
ParticipantAlso, is there a way to have a “confirm email” field? I want to make it so that there is an error message displaying if the two email fields do not match.
rubyj
ParticipantActually, nevermind, figured this out for myself using this tutorial in case anyone else is ever in need of it: http://www.homeandlearn.co.uk/php/php12p2.html
Thanks!
rubyj
ParticipantOk thanks. And any easy tutorials you could point me to for setting up the database? I am new to this so if you could point me in the right direction, I would really appreciate it.
rubyj
ParticipantThis worked like a charm. Thank you!
- AuthorPosts