[SOLVED] How to get selected value of radio as string?

I have a group of radio button, I want to get string but I get number

  f7-list-item(:key='1', radio='', name='language', :checked="language === '1'", @change="language = $event.target.value", :value='1', :title="'English'")
  f7-list-item(:key='2', radio='', name='language', :checked="language === '2'", @change="language = $event.target.value", :value='2', :title="'Deutch'")
  f7-list-item(:key='3', radio='', name='language', :checked="language === '3'", @change="language = $event.target.value", :value='3', :title="'Espanol'")
  data: function() {
    return {
      language: 'english'

this code logs 1 or 2 or 3
    saveLanguageSetting:function() {
      console.log('selected language ' + this.language)

I tried few things like this, changed value to es but this time get -> on
Or I tried to change all of them, changed, key, checked and value to es. again not worked

  f7-list-item(:key='3', radio='', name='language', :checked="language === '3'", @change="language = $event.target.value", :value='es', :title="'Espanol'")

You get number, because you have number in value attribute

As showed in code at bottom, I also tried value as string but get β€œon” instead of the string I wrote, I tried every combination, can you write me exact line that will work ?

I will suggest you not to use value at all here, because Vue bindings allow to avoid it:

  :checked="language === 'english'"
  @change="language = 'english'"

  :checked="language === 'deutch'"
  @change="language = 'deutch'"
1 Like

Hmm. actually I noticed that example in f7 vue docs does have value but not have key, and I took code from f7 template, maybe the key is unnecessary, can you tell me where I can use key ? do I need it ?

1 Like