• Resolved Goran

    (@hrvan)


    Hi.
    I have a simple question. I want to hide a dropdown and show the value in an input field.
    How can I do that? dropdown is fieldset1, and input fieldset2.

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello,

    You simply should enter the special class name: hide through the “Add CSS Layout Keywords” attribute of the DropDown field, and for the input field use a calculated field configured as follows:

    – Assuming the DropDown field is the fieldname1, the equation of calculated field would be: fieldname1

    – If you want it be an input field, untick the checkbox: “Read Only”

    and that’s all.
    Best regards.

    Thread Starter Goran

    (@hrvan)

    Hi.
    I’m getting the filedname1 id instead of the value in fieldname2

    Plugin Author codepeople

    (@codepeople)

    @hrvan,

    Could you send me the link to the webpage where the form is inserted for checking it, please?

    Best regards.

    Thread Starter Goran

    (@hrvan)

    In the fieldname2 I want to show the post_title of the post person comes from.
    I’m passing the post_id over the URL with postid=1 for example. I’ve managed to get the name of the post_title in fieldname1 which is dropdown. If I could get it inside the input field then I don’t need dropdown. How can I do that?

    Thread Starter Goran

    (@hrvan)

    I have it locally on my laptop still

    Plugin Author codepeople

    (@codepeople)

    Hello @hrvan,

    I don’t know how your form was implemented without check it, however, if you have a DropDown field in the form, I will call it fieldname1 but the fields’ names are generated dynamically, and you want fill an input field with the choice selected in the DropDown field, the easier solution would be use a calculated field as the input field whose equation would be simply:

    fieldname1

    and that’s all.
    Best regards.

    Thread Starter Goran

    (@hrvan)

    so what I did was for dropdown (fieldname1) i’m using dropdown ds, and populate it with post_title from table {wpdb.posts}. In the page where I have a form I’m using:
    [CP_CALCULATED_FIELDS_VAR name=”postid”]

    <SCRIPT>
    cpcff_default={1:{}};
    cpcff_default[1]['fieldname1']=postid;
    In the url I've added ?postid=1 to get the post id.
    And this works in the dropdown. I want to hide this dropdown with css, and show it's value in the input (or calculated field) fieldname2.
    With only fieldname1 I'm actually getting 1 as value.
    </SCRIPT>

    Plugin Author codepeople

    (@codepeople)

    Hello,

    I guess it is happening because the values of choices in the DropDown field are the posts’ ids, if you want to use the text of the choice selected the equation associated to the calculated field would be:

    (function(){
    var tmp = fieldname1;
    return jQuery('[id*="fieldname'+'1_"] option:selected').text();
    })()

    I’m sorry, but I cannot give you a more precise support without checking your form. Please, upload your website to an online server.

    Best regards.

    Thread Starter Goran

    (@hrvan)

    Hello.

    Thank you. This is working.

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘dropdown into input’ is closed to new replies.