How to change input value in formly?

How to change text input name with radio buttons?

  • Here is the text input box: <input type="text" name="english" onkeyup="transcrire()" id="pfc_words" title="<?php echo _pfc("Enter your message here"); ?>" maxlength="<?php echo $max_text_len; ?>"/> I have the following radio buttons: <input type="radio" name="language" value="" checked onClick="french();"/><label for="language">French </label> <input type="radio" name="language" value="" onClick="english();"/> <label for="language">English </label> i need a function to change the name of the text input "english" depending on the radio button selected. if the first radio button is selected i want the text input name set to "french" and if the second radio button is selected i want text input name set to "english".

  • Answer:

    <input type="text" name="english" id="pfc_words"... <input type="radio" name="language" checked onClick="setInputName('French')"/> <script type="text/javascript"> function setInputName(name) { var inputElement = document.getElementById('pfc_words'); inputElement.name = name; } </script>

dav c at Yahoo! Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.