We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Locked Topic
[ C ] Flexible Form Script Add On;
Topic Started: Aug 12 2015, 07:20 PM (305 Views)
Tyler Dream
Member Avatar
Member
[ *  *  *  * ]
ZB
URL in profile
I was wondering if it's possible for the flexible form script to have an add on that would allow me to create a text field that if members didn't type in the right answer, it wouldn't submit the form. Is this possible?

It's like a question/answer field
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
HTML:
Code: HTML
 
<tr id="captcha">
<td>TITLE</td>
<td><input type='text' /></td>
</tr>
JavaScript:
Code:
 
<script type="text/javascript">
$(function() {
var rAnswer = 'RIGHT_ANSWER';

form_script.form_id.find('button').click(function(e) {
if ($('#captcha input').val() !== rAnswer) {
e.preventDefault();
alert('You inserted the wrong answer for the CAPTCHA');
}
});
});
</script>
Edit the capitalized text as necessary.
Offline Profile Goto Top
 
Tyler Dream
Member Avatar
Member
[ *  *  *  * ]
What if there are multiple right answers? and this goes below the script on the webpage right?
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
You can use this version for multiple right answers:
Code:
 
<script type="text/javascript">
$(function() {
var rAnswer = ['RIGHT_ANSWER', 'RIGHT_ANSWER', 'RIGHT_ANSWER'];

form_script.form_id.find('button').click(function(e) {
for (var i = 0; i < rAnswer.length; i++) {
if ($('#captcha input').val() === rAnswer[i]) {
form_script.form_id.submit();
} else {
e.preventDefault();
alert('You inserted the wrong answer for the CAPTCHA');
}
}
});
});
</script>
Yes, below all the Flexible Form Script coding is fine.
Offline Profile Goto Top
 
Tyler Dream
Member Avatar
Member
[ *  *  *  * ]
That works. I have another question though. What if I wanted to have a profile field appear based on the answer of a previous question?

For example:

If they select "Inactive Guild Member", another question would appear, asking: We're sad to see you go! Please explain why you're becoming inactive". If they select, "Reactive Guild Member", it'll say "Welcome Back!"
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Can I see the exact code you're using and the new fields you want to appear based on multiple choice selection?
Offline Profile Goto Top
 
Roby
Member Avatar
#27

Completed!

Your request has been completed. If you have any questions or concerns regarding the state of your request, please feel free to contact me via PM.
Offline Profile Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Closed Requests · Next Topic »
Locked Topic