I'm attempting to auto fill an application (presently using contact page 7) with wordpress user particulars.

this is actually the current code:

<script type="text/javascript">
    if (is_user_logged_in()){   
        global $current_user;
        get_currentuserinfo(); ?>
        document.getElementByName("your-name").value = "<?php $current_user->user_email ?>";
    } ?>

I'm while using contact page 7 wordpress plugin so it's known as via short code.

Nothing appears to occur with this particular code however i have become it to echo me the consumer email and so i don't believe that it is an issue with fetching the information. Basically needed to wager, it might be an issue with filling the shape using the data.

I've come across some auto fill plug ins for contact page 7 however i also do along with other forms (particularly gravity forms) and so i require a universal solution.

Any assistance is greatly appreciated, thanks.

First make sure that your contact page has HTML like <input name='your-name' ...> Then try to place your code in the window.onload event. Your javascript is most likely running prior to the page has finished loading everything as well as your contact page.

Something similar to this:

<script type="text/javascript">
window.onload = function () {
    document.getElementsByName("your-name")[0].value = "<?php $current_user->user_email ?>";

Edit: Fixed according to comments below