从SHAREPOINT INFOPATH浏览器启用的表单上的输入字段中获取值 [英] Grab value from input field on SHAREPOINT INFOPATH browser enabled form

查看:135
本文介绍了从SHAREPOINT INFOPATH浏览器启用的表单上的输入字段中获取值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将文本框的值转换为JavaScript变量.最终,我试图根据文本框中的值隐藏或显示不同的Web部件.我将代码拼接在一起以首先测试输入.以下是我从Firebug中拉出的文本框的代码:

I'm trying to get the value of a textbox into a JavaScript variable. ultimately I'm trying to hide or show different webparts depending on the value in the textbox. I'm piecing the code together to test for input first. Below is the code for the textbox in question that I pulled from Firebug:

<input onfocus="return (TextBox.OnFocus(this, event));" onblur="return (TextBox.OnBlur(this, event));" oninput="return  (TextBox.OnInput(this, event));" id="ctl00_m_g_ff1af521_db80_4f46_9a65_42671828173f_FormControl0_V1_I1_T82" scriptclass="TextBox" class="z_VYBB68eomwymAKXW_0 c5_VYBB68eomwymAKXW_0 ef_VYBB68eomwymAKXW_0" wrapped="true" direction="ltr" viewdatanode="83" formid="ctl00_m_g_ff1af521_db80_4f46_9a65_42671828173f_FormControl0" originalid="V1_I1_T82" tabindex="0" title="" value="Visible" style="position: relative;" type="text">

如果我使用下面的代码,则会收到未定义"错误消息(弹出窗口).正如您可以清楚地看到的那样,如上面的代码所示,textbox的值="Visible".

If I use the code below I get an "Undefined" error message(popup). As you can clearly see though, the value of the textbox = "Visible" as the code above tells us.

$(document).ready(function() 
{
    var HideWeb = $("#ctl00_m_g_ff1af521_db80_4f46_9a65_42671828173f_FormControl0_V1_I1_T82").val();
    alert(HideWeb);
});

我也尝试了以下操作,但均未成功(弹出返回为空).

I've also tried the following with no success (popup returns empty).

var HideWeb = document.getElementById("#ctl00_m_g_ff1af521_db80_4f46_9a65_42671828173f_FormControl0_V1_I1_T82").value;
    alert(HideWeb);

我还尝试使用其他ID号,希望其中一个可以在上面的JavaScript \ Jquery代码中使用.如果有人可以将其分开并帮助我确定问题出在哪,我将不胜感激.

I've also tried using the other ID numbers in hopes that one of them would work in the JavaScript\Jquery code above. If someone could pick this apart and help me determine what the problem is I would appreciate it.Thank you.

这对应于我在这里问的一个问题.... https://sharepoint.stackexchange.com/questions/113969/showing-hiding-webparts-conditionally

This correspondes to a question I asked here....... https://sharepoint.stackexchange.com/questions/113969/showing-hiding-webparts-conditionally

推荐答案

您可以尝试..

$("input:text[originalid='V1_I1_T82']").val()

这将返回您的值.

这篇关于从SHAREPOINT INFOPATH浏览器启用的表单上的输入字段中获取值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆