English 中文(简体)
压缩形式
原标题:Wordpress form autofill

我正试图自动填写一个表格(目前使用的是联系表7),并填写文字用户细节。

这是现行法典:

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

我正在使用第7号接触表,以便用短码发出。

这部法典似乎没有发生,但我不得不重复使用电子邮件给我,因此我认为,它的问题在于收集数据。 如果我不得不说,用数据填写表格就是一个问题。

我看到一些汽车填充了接触表7的原始材料,但我也希望以其他形式(具体严重程度表格)这样做,因此我需要一个普遍的解决办法。

非常感谢任何帮助。

最佳回答

First ensure that your contact form has HTML like <input name= your-name ...> Then try and put your code inside a window.onload event. Your javascript is probably running before the page has finished loading everything including your contact form.

与此类似:

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

Edit: 固定不变

问题回答

暂无回答




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签