Masked Text Box issue

走远了吗. 提交于 2020-01-05 07:50:33

问题


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

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.


回答1:


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.

With Watir I was able to set it via using

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

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)

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...)

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.



来源:https://stackoverflow.com/questions/7845739/masked-text-box-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!