I was just messing around in the designer and thought it would be good if you could use the name that was entered in a form, to personalise the success message.
In the success area of the form, and a div and give it an ID of namehere. This is where the name from the form input will get displayed.
You can style this element in the text however you like.
Adding the code
Copy this code, and add it to the page settings before the </body> section. You will need all of this including the <script> tags. I’ve used ES5 syntax for more support, although it works with ES6 in most browsers I believe.
<script>
var userName = document.getElementById('name')
var showName = document.getElementById('namehere')
var submit = document.getElementById('submitbutton')
window.onload = function() {
submit.onclick = function() {
showName.innerHTML = userName.value
}
}
</script>
This just takes the input value when the submit button is clicked, stores it, and adds it to the div with the namehere ID. You can style it all however you like.
Hi, so you would need to add another element for the last name…
In the original script, you should be able to see the correlation between getting the username, and adding it to the Success message.
So for first and last names, you will need the value from each field, and show them in individual elements. In this case I made two variables firstName and lastName.
<script>
var firstName = document.getElementById('first-name')
var lastName = document.getElementById('last-name')
var showName = document.getElementById('namehere')
var submit = document.getElementById('submitbutton')
window.onload = function() {
submit.onclick = function() {
firstName.innerHTML = usersFirstName.value
lastName.innerHTML = usersLastName.value
}
}
</script>
Thanks. It works! Haha. Do you mind I asked you another question? Do you know how to generate a permanent membership / counter number like how thefutur.com created after user registered?
As for the last question, this would be with more custom code, I would create a new thread in the custom code section asking the question so that others can see and help out.
My guess would be that each new member is added to a database, and they can then access that number via an API and render it when you log in.