Hello everyone!
I created a form so visitors can leave testimonials on my website that are then displayed in a repeater on my home page to show the 3 most recent ones. And here’s my issue:
Not only do I display the testimonial itself, but also the name and last name. But having two different fields in my form (and thus database), I had to create two text boxes in my repeater, one for the name and the other for the surname and first thought: I’m going to align the first text on the right and the other on the left. However, by doing so, the whole [name-last name] isn’t centered in the repeater unless both are of equal length (if the name is too long, the whole is too much on the left and vice versa if it’s the last name that’s too long).
To change that, I thought I could create a “fused” field in my database that would have had name+lastname as value, but discovered such fusion it is currently impossible on Wix unlike Excel.
So then, to counter the issue, of course, I thought of the simplest solutions like centering the first and last names by putting them one on top of the other or having only one field in my form for both first and last name, but I obviously found them much less aesthetic (the design I wish for isn’t optimal for the first solution [leaves a void under the name if the person doesn’t insert any last name] and the second one seems too unusual for visitors and less “pretty”)…
I ended up wondering if the solution couldn’t actually be coded. Through coding, I thought of creating a third field (invisible for the visitors) which would add the first and last name fields at the time of the input by the visitor and whose value would then be inserted in my name+lastname field in my database. But obviously, I didn’t manage to do that…
For now, I have a code that looks like this:
let valeurData1 = “0”
let valeurData2 = “0”
$w.onReady(function () {});
export function prenom_input(event) {
valeurData1 = $w(‘#prenom’).value;
}
export function nom_input(event) {
valeurData2 = $w(‘#nom’).value;
$w(‘#result’).text = valeurData1 + " " + valeurData2;
}
export function temoignages_ready() {
$w(‘#temoignages’).getCurrentItem().prenomNom = $w(‘#result’).text;
$w(‘#temoignages’).save();
}
I know that this code is wrong and will never work, but is there a way to do what I’d like to do with a similar code (or just any code) or is it simply impossible to do?
I am begging for help, really