Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/88.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 将输入文本传递到操作字段_Html - Fatal编程技术网

Html 将输入文本传递到操作字段

Html 将输入文本传递到操作字段,html,Html,我想将输入字段传递到表单动作部分覆盖字段;所以它看起来像/{user}/u域中的某个{u整数},如果你知道我的意思的话 <form action="<c:url value='${user}/?field'/>" method="post" > <input type="hidden" name="_method" value="DELETE"> <input type="text" name="fie

我想将输入字段传递到表单动作部分覆盖字段;所以它看起来像/{user}/u域中的某个{u整数},如果你知道我的意思的话

<form action="<c:url value='${user}/?field'/>"
          method="post" >
        <input type="hidden" name="_method" value="DELETE">
        <input type="text" name="field" id="field"/>
        <input type="submit" value="DELETE">
    </form>


有人能帮忙吗?这可能吗?

我看到您只标记了HTML。你还使用什么语言?我建议您根据用户变量通过JavaScript更改所需的操作

HTML

JavaScript

var sub=document.getElementById('submitBtn');
//单击sub时,比较用户变量
sub.addEventListener('click',函数(事件){
如果(用户==1){
//执行后操作1
}else if(用户==2){
//执行后操作2
}
//等等。。。
});

随着字段的更改,您必须更改
user
变量。

不明白您在这里要做什么。
<form>
    <input type="hidden" name="_method" value="DELETE">
    <input type="text" name="field" id="field"/>
    <input type="submit" value="DELETE" id="submitBtn">
</form>
<script>
    var sub = document.getElementById('submitBtn');

    // When sub is clicked, compare user var
    sub.addEventListener('click', function(event){
        if(user == 1){
            // Perform post action 1
        }else if(user == 2){
            // Perform post action 2
        }
        // etc...
    });
</script>