Affecting a field from another field's updates

Hi all!

Currently I’m building a site for a gaming community. On this site, I will enable the user role to creating a new or editing the existing membership profile on the database through the connected form to the database. There are things I would like to ask:

  1. On the new membership form, it has five input boxes: Username , Rank , Skill , Display Motto Preview and Join Date . When a user has entered the information to the Rank and Skill boxes, I want to make the Display Motto Preview box automatically fetches the information from those fields. For example the user entered “Colonel” on the Rank box and “Hunter” on the Skill box, so the Display Motto Preview box will be “(IN) Col, Hunter.” Note that (IN) is a default prefix motto given, followed by the abbreviated rank, then lastly the skill. When submitted, this Display Motto Preview will be recorded in the Motto field in the database. Can you help me to figure out the correct code for this?

  1. I will also enable the user to edit the existing member’s information through the form, for example when the member has been promoted or even demoted, so their rank must be updated. I want to make a separate form for this, so I need to figure out to creating a “browse & edit” form without making them as the site contributor. Is it possible and can you point out how to do it?

  2. The user will be also allowed to “discharge” a member. Means that the discharged member’s profile won’t be visible in the main database or main dynamic page but will be moved to another database or displayed in “discharged” dynamic page. Is it possible to do it from a single click “discharge” button?

  3. Lastly I want to ask how to fetch an image from a URL on the database collection field instead of manually uploading it (as we might have hundreds of member). What’s on my mind: the dynamic page will show the member’s profile, including their avatar. The avatar itself will be fetched from the actual profile of the game’s website. So whenever we made a new field of a profile on the database, the username field will recall the URL of the avatar and the image will be fetched. I’ve tried this trick on spreadsheet with =HYPERLINK(CONCATENATE) and combination of =IMAGE function. Is it possible?

Thank you in advance & have a great day ahead!

Hi,

  1. You can set an onChange event to fire each time the data is changed in the Rank and Skill.
    Then take their values and set it to the Motto preview box.
$w("#rank").onChange( (event, $w) => {
 let newValue = event.target.value; // grab the value
 
 $w("#mottoBox").text = 'newValue' + ' ' + $w("#skill") //add the values together and set to mottobox
 });
  1. You can find a step by step for creating member profile pages here.
    It is similar to what you are describing since it allows users to edit their own profile.
    Velo Tutorial: Building Your Own Members Area | Help Center | Wix.com

  2. Another option is adding a boolean field to your collection, naming it ‘isDischarged’.
    For any discharged characters simply tick this boolean field. Filter ‘isDischarged’ characters from the main character list.

  3. Setting a link as a profile image is very much possible. Simply add a url field to your character collection.
    If the image url is determinable use simple string concatenation (+) to construct the url, similar to question 1.
    For example:

let facebook = 'www.facebook.com/'
let user = 'dave'
let profileImage = facebook + dave + '.png' //'www.facebook.com/dave.png'

Good luck!

imperialnavytech… you might want to see my page here: https://www.imagineimage.org/player-form

Hi Ido! Thanks for the help. It works for Q2-4, however, the Q1 is remain unsolved.
I tried to enter the code you provided but then I got 3 error messages.

let newValue = event.target.value; // grab the value —> newValue is unread.
$w(“#mottoBox”).text = ‘newValue’ + ’ ’ + $w(“#skill”) //add the values together and set to mottobox —> text is undefined & missing semicolon.

I’ve tried to figure out the code but still it doesn’t work. The motto box didn’t display the values of Rank & Skill.