Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/451.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
使用javascript jsf2更改h:inputText属性_Javascript_Jsf 2_Input_Converter - Fatal编程技术网

使用javascript jsf2更改h:inputText属性

使用javascript jsf2更改h:inputText属性,javascript,jsf-2,input,converter,Javascript,Jsf 2,Input,Converter,我有以下意见: <p:column headerText="Quantité"> <h:inputText styleClass="maqte" id="qte" onkeyup="validerInput($(this),$(this).parent().prev().find('.monpu'));" value="#{car.qte}" converter="lenientDoubleConverte

我有以下意见:

    <p:column headerText="Quantité">
        <h:inputText styleClass="maqte" id="qte"
            onkeyup="validerInput($(this),$(this).parent().prev().find('.monpu'));"
            value="#{car.qte}" converter="lenientDoubleConverter" >

        </h:inputText>
    </p:column>

如上面代码所示(
converter=“lenientDoubleConverter”

但是当用户点击一个按钮后,我想启用它,然后我应该在请求发送到服务器之前用javascript删除这个转换器

有没有办法用javascript删除这个属性


提前感谢

只需将此属性设置为空值即可

$(element).removeAttr("converter");
document.getElementsById("qte").setAttribute("converter","");

只需将空值设置为此属性

document.getElementsById("qte").setAttribute("converter","");
有没有办法用javascript删除这个属性

否。右键单击页面并在您喜爱的浏览器中查看源代码。您将看到JSF代码生成一个和所有HTML代码。JSF组件的
converter
属性在
生成的HTML输出中没有表示。更重要的是,转换器根本不在客户端运行。它只是一个服务器端声明,转换器在服务器端运行

最好的办法是让按钮添加一个特定的请求参数,该参数指示转换器不宽容。例如

<p:commandButton ...>
    <f:param name="disableLenientDoubleConverter" value="true" />
</p:commandButton>
有没有办法用javascript删除这个属性

否。右键单击页面并在您喜爱的浏览器中查看源代码。您将看到JSF代码生成一个和所有HTML代码。JSF组件的
converter
属性在
生成的HTML输出中没有表示。更重要的是,转换器根本不在客户端运行。它只是一个服务器端声明,转换器在服务器端运行

最好的办法是让按钮添加一个特定的请求参数,该参数指示转换器不宽容。例如

<p:commandButton ...>
    <f:param name="disableLenientDoubleConverter" value="true" />
</p:commandButton>

这是jQuery,不是JavaScript:)jQuery实际上是JavaScript;)。但我明白你的意思。这是jQuery,不是JavaScript:)jQuery实际上是JavaScript;)。但是我明白你的意思了。谢谢你,巴卢斯克,我测试过它:
它只在转换完成时启动actionListener方法,但我有一个问题:我放在inputText中的
p:message
(数据表内)不显示错误:
我不知道你为什么忘了写消息。然而,这是一个不同的问题。如果您仍有问题,请按
提问
。谢谢您,BalusC,我测试过它:
它只在转换完成时启动actionListener方法,但我有一个问题:我在inputText(数据表内)中输入的
p:message
不显示错误:
我不知道你为什么忘了写消息。然而,这是一个不同的问题。如果您仍然口吃,请按
询问问题