Adding the input of an element to my...

User 2902462 Photo


Registered User
45 posts

Eric Rohloff you wrote the code for me to use.
I ask them what 2*3 = and when they do not type in the correct answer I give them an error.
NO...….What does 2*3 =
Two things how can I pick up the answer from the question and use it in the error message
1. like NO.....2*3 does not = [answer]
2. When I put a number in the question element no error comes up until I click to another element.
The code from this site will make the Submit button unhide with the correct answer.
David Doyle
User 187934 Photo


Senior Advisor
20,188 posts

Hi David,
Give this a try.
Change the input name ruhuman to match yours.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script>
var jQ = $.noConflict(true);
// version 1
jQ(document).ready(function () {
jQ('input[name="ruhuman"]').on('blur', function() {
var Value = jQ(this).val();
if(Value == ''){Value='0';}
jQ(this).next('label').append(' '+Value);
});
});
</script>
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2902462 Photo


Registered User
45 posts

I'm not sure where do I put the script and how do I pick up the answer an put it in an error message for an element
David Doyle
User 187934 Photo


Senior Advisor
20,188 posts

Put it just above the </head> tag in your form or in a html element.
Working here.
http://progrowerhtml.coffeecup.com/form … r-message/
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2902462 Photo


Registered User
45 posts

Thank you Eric for your help. Is there away to make the error message come up with out clicking on another field. If the answer is correct the submit button unhides but if you put any other answer nothing happens until I click on another field.
David Doyle
User 187934 Photo


Senior Advisor
20,188 posts

Check to see what you have set for max errors.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2902462 Photo


Registered User
45 posts

For the answer input field name human
I have Max length 1
RegEx /^[6]+$/
I attached 2 files that you wrote. They are used for the answer input field and Submit button.
Attachments:
David Doyle
User 187934 Photo


Senior Advisor
20,188 posts

In the Form Builder check to see what you have set for Max Errors on the form options tab.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 2902462 Photo


Registered User
45 posts

The Max Errors had no value. I set it to 1 an published the form. Type in a wrong number and nothing happens. But if I click on another field the error message will show up.
David Doyle
User 187934 Photo


Senior Advisor
20,188 posts

Is the input the first thing filled in? What happens i you fill in other inputs first?
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.