[Wtr-general] problem filling text_field - validation fails
Paul Rogers
paul.rogers at shaw.ca
Wed May 2 23:34:44 EDT 2007
Hi Timm
I dont see any code that would do validations in the html you've supplied
you can also try this, which may help
$b.link(:id, "ownerToolbox_reportSale").click
$b.text_field(:id, "ownerToolbox_askingPrice").value="234567"
$b.radio(:id, "ownerToolbox_agent").set
$b.button(:name, "SubmitButton").click
this does some slightly different things
----- Original Message -----
From: Timm Mason
To: wtr-general at rubyforge.org
Sent: Wednesday, May 02, 2007 6:06 PM
Subject: [Wtr-general] problem filling text_field - validation fails
Hi, I'm having a problem with a text_field. If I populate the value with Watir, then submit, there is a validation that fails. However, I can manually type in the same value and the validation passes.
Here's some HTML:
<li class="post">
<a onclick="toggle('ownerToolbox_reportSale'); $('ownerToolbox_askingPrice').focus();" href="javascript:void(0)" id="ownerToolbox_reportSale">Tell us it's for sale</a>
<div id="ownerToolbox_reportSale_toggleArea" class="hide tooltip reportForSale">
<a onclick="toggle('ownerToolbox_reportSale')" href="javascript:void(0)" class="close">Close</a>
<dl>
<dt>Is This Home For Sale?</dt>
<dd>
<form method="post" action="/HomeDetails,ownerToolbox.reportForSalePopup.reportForSaleForm.sdirect" name="reportForSaleForm_0" id="reportForSaleForm_0">
<div style="display:none;"><input type="hidden" name="formids" value="ownerToolbox_askingPrice,salePriceField,claimTypeRadioGroup,SubmitButton"/>
<input type="hidden" name="form:HomeDetails" value="ZH4sIAAAAAAAAAI1Svy9DURQ+r9EY/EhpYkNDrQ8J0ZEmGk2kXjB1u7zTuvp673Xefb1tB2FhsLIZDMb+K0a7WIVVYnJfUSGRGu5w7znfd77z3a/zDEkzDAD2JEPNNCozCDDQVtwPCcYOWYO5ARNVtyg0VpHGH29uX0/PcwlwipBssCDCJkHqu68U1feQzjpXk0OXDxcJgKZKPBXALDowLY1A2pUy2JNNl1BJ0gVJOyxAT6pIwYhCCnmo0S/H84/gGKALzjmQkZUKUlFUpJsNuKiFWY9khQe47nO9aR8g3UNvo45IeKyKGlL1VpsHgTTzn/1mwYGpbzLNarjVQPJkqLmo9hEyCjAkiaOwVnEpNCRLdokDs+LAXBstQ91auIHMR3KZ7+dJ1pCsjnhUH+rVf1NM9Ch6xRKr213BLDkw85ukr9GxhkGz7MDsb2ikfHuJcX8t8IFNA6S0xa75occo1mJ7fsQnb38dmbjL0Mn99duLjU/5Kz4KupHb57ql3gFtyY3GkAIAAA=="/>
<input type="hidden" name="reservedids" value="form:HomeDetails"/>
<input type="hidden" name="submitmode" value=""/>
<input type="hidden" name="submitname" value=""/>
</div>
<fieldset>
<p class="price"><label for="ownerToolbox_askingPrice">Sale price<span class="required">*</span>:</label> <!-- sale price -->
<input type="text" name="salePriceField" value="" id="ownerToolbox_askingPrice"/>
</p>
<p>What is your relationship to this home?</p>
<ul class="ownerToolbox_relation">
<li><input type="radio" name="claimTypeRadioGroup" value="0" id="ownerToolbox_owner"/> <label for="ownerToolbox_owner">Owner</label></li>
<li><input type="radio" name="claimTypeRadioGroup" value="1" id="ownerToolbox_agent"/> <label for="ownerToolbox_agent">Listing agent</label></li>
<li><input type="radio" name="claimTypeRadioGroup" checked="checked" value="2" id="ownerToolbox_other"/> <label for="ownerToolbox_other">Other</label></li>
</ul>
<input type="hidden" name="HomeDetails/ownerToolbox.reportForSalePopup.reportForSaleForm_SubmitButton_submitflag" id="HomeDetails/ownerToolbox.reportForSalePopup.reportForSaleForm_SubmitButton_submitflag" value="0"></input>
<button type="submit" name="SubmitButton" onclick="document.getElementById('HomeDetails/ownerToolbox.reportForSalePopup.reportForSaleForm_SubmitButton_submitflag').value='1';" title="Submit" class="primary">
<span>Save</span>
</button>
<button onclick="toggle('ownerToolbox_reportSale')" href="javascript:void(0)" type="button" class="em">
<span>Cancel</span>
</button>
</fieldset>
</form>
</dd>
</dl>
</div>
</li>
And my code:
$b.link(:id, "ownerToolbox_reportSale").click
$b.text_field(:id, "ownerToolbox_askingPrice").set("234567")
$b.radio(:id, "ownerToolbox_agent").set
$b.button(:name, "SubmitButton").click
Just started working with Watir and it's great so far. Any help is appreciated!
____________________________________________________
Timm Mason
Software Test Engineer
P (206) 757-2736
F (206) 470-7001
------------------------------------------------------------------------------
_______________________________________________
Wtr-general mailing list
Wtr-general at rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-general
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/wtr-general/attachments/20070502/cf0e5894/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 1128 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/wtr-general/attachments/20070502/cf0e5894/attachment.gif
More information about the Wtr-general
mailing list