开发者

Set input text box to data then submit to php

Basically i have a textbox on my .html page

<input name="points" type="text" id="points" value=""/>
开发者_如何转开发

and in the .js that gets called just onsubmit

document.getElementById('points').value = creator.showData();

i actually see with my eyes that the text is being added to the textbox however the php isn't reading the $_POST however if i manually enter the text into the same text box it works.

Any Ideas ? been screwing with my head all morning XD


It probably submits the form before the value is set.

Try this...

(function() {    
    var submitted = false;
    form.onsubmit = function(event) {
        if (submitted) {
            return true;
        }
        event.preventDefault();
        document.getElementById('points').value = creator.showData();
        submitted = true;
        form.submit();
    }
})();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜