屏蔽文本框问题 [英] Masked Text Box issue

查看:23
本文介绍了屏蔽文本框问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为电话字段使用 rad 屏蔽控件.

i m using the rad masked control for phone field.

telerik:RadMaskedTextBox ID="txtPhone1" runat="server" EnableAjaxSkinRendering="False" Mask="(###) ###-####" Skin="Hay" ZeroPadNumericRanges="False" MaxLength="20" TabIndex="30" Width="200px"></telerik:RadMaskedTextBox

当我尝试使用 watir 添加电话时,使用此代码

when i m trying to add phone using watir, using this code

browser.text_field(:id => 'ctl00_ContentPlaceHolder1_Registration2_txtPhone1_text').set '7893457889'

仅添加了最后一个值.请帮帮我.如何填充屏蔽值.

only last value has been added. kindly help me out. how to fill masked value.

推荐答案

使用 Watir-webdriver 和来自 Teleriks 演示站点 和 IE 浏览器,我可以使用

Using Watir-webdriver and the example from Teleriks demo site, and IE browser, I was able to set the value with

browser.text_field(:id,"RadMaskedTextBox1_text").set '1234567890'

这似乎按预期工作,添加了格式,对我来说似乎很实用.

This seemed to work just as expected, added the formatting, and seemed functional to me.

使用 Watir 我可以通过使用来设置它

With Watir I was able to set it via using

browser.text_field(:id, 'RadMaskedTextBox1_text').value='1234567890'

然而,尽管该值显示在该字段中,但它没有格式化,我永远无法让它实际验证该输入.我尝试触发各种事件,如 onchange,让客户端代码处理它,但没有乐趣.如果我正在使用此工具,我可能会考虑致电供应商或访问他们的网站并在此时寻求他们的帮助.(前提是你需要使用 Watir)

However although the value showed up in the field, it was not formatted and I was never able to get it to actually validate that input. I tried firing various events such as onchange, to get the client side code to process it, but no joy. If I was using this tool I might consider calling the vendor or getting on their site and asking them for assistance at this point. (provided you need to use Watir)

如果 watir-webdriver 对您来说不是一个可行的选择(我喜欢它用于跨浏览器测试),那么也许其他人可以花时间深入挖掘一下.(我个人已经超过了挖掘这种控制以扩展我自己的知识值得我的雇主花时间的地步......)

If watir-webdriver is not a viable option for you (I like it for cross browser testing) then perhaps someone else can spend the time to dig a bit deeper. (I'm personally past the point where digging into this control to extend my own knowledge is worth my employers time...)

Rautomation 可能有一些方法可以解决这个问题,但我对它很陌生,我没有立即看到一个简单的解决方案.

Possibly there might be some way around this with Rautomation, but I'm new enough with it where I don't immediately see an easy solution there.

这篇关于屏蔽文本框问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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