CFV5 Copy and paste value

afgaleano1212 02 Mar, 2020
how are you?

I need your valuable help, I want to copy and paste the value of a textbox to a dropdown when loading the form.

Thank you
GreyHead 02 Mar, 2020
HI afgaleano1212,

I'm sorry but I don't understand - what exactly do you need to do?

Bob
afgaleano1212 02 Mar, 2020
In a field I have the name of the user who logged in to see the form with the following code:

[strong]<?php
if ( isset($form->data['name']) && $form->data['name'] ) {
$name = $form->data['name'];[br]} else {[br] $user =& JFactory::getUser();[br] $name = $user->name;[br]}[br]?>[br]<input type='text' readonly='readonly 'name='name' id='name' value='<?php echo $name; ?>' /> [/strong]
    [br][br]That value, which is in that "name" field, I want to pass it to another field of type dropdrow called "names"
    healyhatman 02 Mar, 2020
    So..... put it in there then?

    <select name=''>
    <option selected value='<?=$name; ?>'><?=$name;?></option>
    </select>
    afgaleano1212 05 Mar, 2020
    Hi healyhatman

    It did not work, enter the code and do not load the form, enter as follows:

    <?php
    if ( isset($form->data['name']) && $form->data['name'] ) {
    $name = $form->data['name'];
    } else {
    $user =& JFactory::getUser();
    $name = $user->name;
    }
    ?>

    <input type='text' readonly='readonly 'name='name' id='name' value='<?php echo $name; ?>' />

    <select name="">
    <option selected value='<?=$names;?>'><?=$name;?</option>
    </select>CFV5 Copy and paste value image 1
    healyhatman 05 Mar, 2020
    You put $names in there did you realise
    This topic is locked and no more replies can be posted.