We hope you'll join us for our 4/23 webinar on using data tables to apply reference ranges and AE codes in OC4. For more information and to register, visit https://register.gotowebinar.com/register/2882170018956684555

JavaScript how to set the textarea automatically change by input in the CRF?

HI all,
who can help me solve the problem,JavaScript how to set the textarea automatically change by input in the CRF?

thanks 
Tagged:
«1

Comments

  • haenselhaensel Posts: 602 ✭✭✭
    Hi huamanzhu

    It might be possible to help you with your question if you provide more details.

    Regards,
    Christian
  • huamanzhuhuamanzhu Posts: 51
    edited January 2015 via Email
    hi haensel.
    first,thanks your patient in my question.
    if set textarea in the eCRF ,look like this:image 
    I want the textarea can automatically change,like this:

    can I help you? the JavaScript could solve this problem?

    Regards,
    huamanzhu
    Post edited by huamanzhu on
  • huamanzhuhuamanzhu Posts: 51
    edited January 2015 via Email
    I can not upload pictures to this site,I sent to your mailbox.

    Regards,
    huamanzhu
  • haenselhaensel Posts: 602 ✭✭✭
    these are the original images from huamanzhu

    if set textarea in the eCRF ,look like this:
    image
    I want the textarea can automatically change,like this:

    image
  • huamanzhuhuamanzhu Posts: 51
    edited January 2015 via Email
    can you help me solve the problem?
  • haenselhaensel Posts: 602 ✭✭✭
    Hi huamanzhu

    I'm no fan of all this javascript stuff in CRFs but others are. I would prefere to add a CSS rule in styles.css

    e.g.

    textarea {
        width: 200px;
        height: 50px;
    }

    If you really want to use javascript for this you can use something like this.
    <script>
    jQuery(document).ready(function($) {
    $('textarea').css({'width':'100px','height':'50px'});
    });
    </script>
    Regards,
    Christian

  • csabahalmagyicsabahalmagyi Posts: 21
    edited January 2015
    Hi huamanzhu,

    You can use the following script in the left item text field (change the width and height as best fits them for you):

    <script src="includes/jmesa/jquery.min.js"></script>

    <script>

        jQuery(document).ready(function() { 

            $('textarea').css({'width':'100px','height':'50px'});

        });

    </script>


    Note: this will change ALL text areas on your current page.


    Kind regards,


    Csaba

  • huamanzhuhuamanzhu Posts: 51
    edited January 2015 via Email
    hi haensel,
    but it only  can control Height and width ,I want it can wrap and automatically change Height and width.
    Thanks


     Regards,
    huamanzhu
  • haenselhaensel Posts: 602 ✭✭✭
    Hi huamanzhu

    Isn't your text wrapped automatically if the box gets smaller? Or are you looking for something that wraps within a word?

    Regards,
    Christian
  • huamanzhuhuamanzhu Posts: 51
    edited January 2015 via Email
    hi haensel,

    Yes,that is I want to it.
    Post edited by huamanzhu on
This discussion has been closed.