Auto fill textbox in a website when multiple Id tags are the same

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<span style="font-family:Verdana,sans-serif; font-size:9pt I would like to fill textbox in a website via my c# program
<span style="font-family:Verdana,sans-serif; font-size:9pt My problem is that the Id tag for the textbox i want to fill is the same as the Id tag as another textbox and the one I want to fill is not the first
<span style="font-family:Verdana,sans-serif; font-size:9pt I can get to the HemlElment i need with the code

<span style="font-family:Verdana,sans-serif; font-size:9pt var oForm = This.Document.Forms[2];
<span style="font-family:Verdana,sans-serif; font-size:9pt this is the innerhtml of the oForm
<span style="font-family:Verdana,sans-serif; font-size:9pt and I need to fill in the username,password,email,timezone
<span style="font-family:Verdana,sans-serif; font-size:9pt <TABLE border=0 cellSpacing=5 cellPadding=0>
<span style="font-family:Verdana,sans-serif; font-size:9pt <TBODY>
<span style="font-family:Verdana,sans-serif; font-size:9pt <TR>
<span style="font-family:Verdana,sans-serif; font-size:9pt <TD align=right>Username:</TD>
<span style="font-family:Verdana,sans-serif; font-size:9pt <TD><INPUT style="WIDTH: 150px" id=username name=username_reg size=30></TD></TR>
<span style="font-family:Verdana,sans-serif; font-size:9pt <TR>
<span style="font-family:Verdana,sans-serif; font-size:9pt <TD align=right>Password:</TD>
<span style="font-family:Verdana,sans-serif; font-size:9pt <TD><INPUT style="WIDTH: 150px" id=password name=password_reg value="" size=30 type=password></TD></TR>
<span style="font-family:Verdana,sans-serif; font-size:9pt <TR>
<span style="font-family:Verdana,sans-serif; font-size:9pt <TD align=right>E-mail:</TD>
<span style="font-family:Verdana,sans-serif; font-size:9pt <TD><INPUT style="WIDTH: 150px" id=mail_reg name=mail_reg size=30> (needed in case you forget your password)</TD></TR>
<span style="font-family:Verdana,sans-serif; font-size:9pt <TR>
<span style="font-family:Verdana,sans-serif; font-size:9pt <TD align=right>Country:</TD>
<span style="font-family:Verdana,sans-serif; font-size:9pt <TD><SELECT name=time_zone> <OPTION value=1>Afghanistan - Kabul [GMT +04:30]</OPTION> <OPTION value=2>Algeria - Algiers [GMT 00:00]</OPTION> <OPTION value=3>Argentina
- Buenos Aires [GMT -03:00]</OPTION> <OPTION value=4>Australia - Australian Capital Territory - Canberra [GMT +10:00]</OPTION> <OPTION value=5>Australia - New South Wales - Sydney [GMT +10:00]</OPTION> <OPTION value=6>Australia
- Northern Territory - Darwin [GMT +09:30]</OPTION> <OPTION value=7>Australia - Queensland - Brisbane [GMT +10:00]</OPTION> <OPTION value=8>Australia - South Australia - Adelaide [GMT +09:30]</OPTION> <OPTION value=9>Australia
- Victoria - Melbourne [GMT +10:00]</OPTION> <OPTION value=10>Australia - Western Australia - Perth [GMT +08:00]</OPTION> <OPTION value=11>Austria - Vienna [GMT +01:00]</OPTION> <OPTION value=12>Bahamas - Nassau [GMT -05:00]</OPTION>
<OPTION value=13>Bangladesh - Dhaka [GMT +06:00]</OPTION> <OPTION value=14>Belarus - Minsk [GMT +02:00]</OPTION> <OPTION value=15>Belgium - Brussels [GMT +01:00]</OPTION> <OPTION value=16>Bolivia - La Paz [GMT -05:00]</OPTION>
<OPTION value=17>Brazil - Brasilia [GMT -03:00]</OPTION> <OPTION value=18>Bulgaria - Sofia [GMT +02:00]</OPTION> <OPTION value=19>Canada - Alberta - Edmonton [GMT -07:00]</OPTION> <OPTION value=20>Canada - British
Columbia - Vancouver [GMT -08:00]</OPTION> <OPTION value=21>Canada - Manitoba - Winnipeg [GMT -06:00]</OPTION> <OPTION value=22>Canada - Newfoundland - St. Johns [GMT -03:30]</OPTION> <OPTION value=23>Canada - Northwest
Territories - Aklavik [GMT -07:00]</OPTION> <OPTION value=24>Canada - Nova Scotia - Halifax [GMT -03:00]</OPTION> <OPTION value=25>Canada - Ontario - Ottawa - Toronto [GMT -05:00]</OPTION> <OPTION value=26>Canada - Quebec
- Montreal [GMT -05:00]</OPTION> <OPTION value=27>Chile - Santiago [GMT -05:00]</OPTION> <OPTION value=28>China - Beijing [GMT +08:00]</OPTION> <OPTION value=29>Colombia - Bogota [GMT -05:00]</OPTION> <OPTION value=30>Croatia
- Zagreb [GMT +01:00]</OPTION> <OPTION value=31>Cuba - Havana [GMT -05:00]</OPTION> <OPTION value=32>Czech Republic - Prague [GMT +01:00]</OPTION> <OPTION value=33>Denmark - Copenhagen [GMT +01:00]</OPTION> <OPTION
value=34>Dominican Republic - Santo Domingo [GMT -05:00]</OPTION> <OPTION value=35>Egypt - Cairo [GMT +02:00]</OPTION> <OPTION value=36>El Salvador - San Salvador [GMT -07:00]</OPTION> <OPTION value=37>Estonia - Tallinn
[GMT +02:00]</OPTION> <OPTION value=38>Ethiopia - Addis Ababa [GMT +02:00]</OPTION> <OPTION value=39>Fiji - Suva [GMT +12:00]</OPTION> <OPTION value=40>Finland - Helsinki [GMT +02:00]</OPTION> <OPTION value=41>France
- Paris [GMT +01:00]</OPTION> <OPTION value=42>Germany - Berlin [GMT +01:00]</OPTION> <OPTION value=43>Greece - Athens [GMT +02:00]</OPTION> <OPTION value=44>Guatemala - Guatemala [GMT -07:00]</OPTION> <OPTION value=45>Honduras
- Tegucigalpa [GMT -07:00]</OPTION> <OPTION value=46>Hungary - Budapest [GMT +01:00]</OPTION> <OPTION value=47>Iceland - Reykjavik [GMT 00:00]</OPTION> <OPTION value=48>India - New Delhi [GMT +05:30]</OPTION> <OPTION
value=49>Indonesia - Java - Jakarta [GMT +07:00]</OPTION> <OPTION value=50>Iran - Tehran [GMT +03:30]</OPTION> <OPTION value=51>Iraq - Baghdad [GMT +03:00]</OPTION> <OPTION value=52>Ireland - Dublin [GMT 00:00]</OPTION>
<OPTION value=53>Israel - Jerusalem [GMT +01:00]</OPTION> <OPTION value=54>Italy - Rome [GMT +01:00]</OPTION> <OPTION value=55>Jamaica - Kingston [GMT -05:00]</OPTION> <OPTION value=56>Japan - Tokyo [GMT +09:00]</OPTION>
<OPTION value=57>Jordan - Amman [GMT +02:00]</OPTION> <OPTION value=58>Kenya - Nairobi [GMT +02:00]</OPTION> <OPTION value=59>Kiribati - Christmas Islands - Kiritimati [GMT +12:00]</OPTION> <OPTION value=60>Kuwait
- Kuwait City [GMT +02:00]</OPTION> <OPTION value=61>Lebanon - Beirut [GMT +02:00]</OPTION> <OPTION value=62>Madagascar - Antananarivo [GMT +02:00]</OPTION> <OPTION value=63>Malaysia - Kuala Lumpur [GMT +08:00]</OPTION>
<OPTION value=64>Mexico - Mexico City [GMT -05:00]</OPTION> <OPTION value=65>Morocco - Casablanca [GMT 00:00]</OPTION> <OPTION value=66>Myanmar - Yangon [GMT +06:30]</OPTION> <OPTION value=67>Nepal - Kathmandu [GMT
+05:45]</OPTION> <OPTION value=68>Netherlands - Amsterdam [GMT +01:00]</OPTION> <OPTION value=69>New Zealand - Wellington [GMT +12:00]</OPTION> <OPTION value=70>Nicaragua - Managua [GMT -07:00]</OPTION> <OPTION
value=71>Nigeria - Lagos [GMT 00:00]</OPTION> <OPTION value=72>Norway - Oslo [GMT +01:00]</OPTION> <OPTION value=73>Pakistan - Islamabad [GMT +05:00]</OPTION> <OPTION value=74>Paraguay - Asuncion [GMT -05:00]</OPTION>
<OPTION value=75>Peru - Lima [GMT -05:00]</OPTION> <OPTION value=76>Philippines - Manila [GMT +08:00]</OPTION> <OPTION value=77>Poland - Warsaw [GMT +01:00]</OPTION> <OPTION value=78>Portugal - Lisbon [GMT 00:00]</OPTION>
<OPTION value=79>Puerto Rico - San Juan [GMT -05:00]</OPTION> <OPTION value=80>Romania - Bucharest [GMT +02:00]</OPTION> <OPTION value=81>Russia - Anadyr [GMT +12:00]</OPTION> <OPTION value=82>Russia - Kamchatka [GMT
+12:00]</OPTION> <OPTION value=83>Russia - Moscow [GMT +03:00]</OPTION> <OPTION value=84>Russia - Vladivostok [GMT +10:00]</OPTION> <OPTION value=85>Saudi Arabia - Riyadh [GMT +02:00]</OPTION> <OPTION value=86>Serbia
and Montenegro - Serbia - Belgrade [GMT +01:00]</OPTION> <OPTION value=87>Singapore - Singapore [GMT +08:00]</OPTION> <OPTION value=88>South Africa - Pretoria [GMT +02:00]</OPTION> <OPTION value=89>South Korea - Seoul [GMT
+09:00]</OPTION> <OPTION value=90>Spain - Madrid [GMT +01:00]</OPTION> <OPTION value=91>Sudan - Khartoum [GMT +02:00]</OPTION> <OPTION value=92>Sweden - Stockholm [GMT +01:00]</OPTION> <OPTION value=93>Switzerland
- Zurich [GMT +01:00]</OPTION> <OPTION value=94>Taiwan - Taipei [GMT +08:00]</OPTION> <OPTION value=95>Thailand - Bangkok [GMT +07:00]</OPTION> <OPTION value=96>Turkey - Ankara [GMT +02:00]</OPTION> <OPTION value=97>U.K.
- England - London [GMT 00:00]</OPTION> <OPTION value=118>Ukraine - Kyiv [GMT +02:00]</OPTION> <OPTION value=119>United Arab Emirates - Abu Dhabi [GMT +03:00]</OPTION> <OPTION value=98>United States - Alabama - Montgomery
[GMT -06:00]</OPTION> <OPTION value=99>United States - Alaska - Anchorage [GMT -09:00]</OPTION> <OPTION value=100>United States - Arizona - Phoenix [GMT -07:00]</OPTION> <OPTION value=101>United States - California - Los
Angeles [GMT -08:00]</OPTION> <OPTION value=102>United States - California - San Francisco [GMT -08:00]</OPTION> <OPTION value=103>United States - Colorado - Denver [GMT -07:00]</OPTION> <OPTION value=104>United States -
District of Columbia - Washington DC [GMT -05:00]</OPTION> <OPTION value=105>United States - Georgia - Atlanta [GMT -05:00]</OPTION> <OPTION value=106>United States - Hawaii - Honolulu [GMT -10:00]</OPTION> <OPTION value=107>United
States - Illinois - Chicago [GMT -05:00]</OPTION> <OPTION value=108>United States - Indiana - Indianapolis [GMT -05:00]</OPTION> <OPTION value=109>United States - Louisiana - New Orleans [GMT -05:00]</OPTION> <OPTION value=110>United
States - Massachusetts - Boston [GMT -05:00]</OPTION> <OPTION value=111>United States - Michigan - Detroit [GMT -05:00]</OPTION> <OPTION value=112>United States - Minnesota - Minneapolis [GMT -05:00]</OPTION> <OPTION value=113>United
States - Minnesota - St. Paul [GMT -05:00]</OPTION> <OPTION selected value=114>United States - New York - New York [GMT -05:00]</OPTION> <OPTION value=115>United States - Pennsylvania - Philadelphia [GMT -05:00]</OPTION> <OPTION
value=116>United States - Texas - Houston [GMT -05:00]</OPTION> <OPTION value=117>United States - Washington - Seattle [GMT -08:00]</OPTION> <OPTION value=120>Uruguay - Montevideo [GMT -03:00]</OPTION> <OPTION value=121>Uzbekistan
- Tashkent [GMT +05:00]</OPTION> <OPTION value=122>Venezuela - Caracas [GMT -05:00]</OPTION> <OPTION value=123>Vietnam - Hanoi [GMT +07:00]</OPTION> <OPTION value=124>Yemen - Aden [GMT +02:00]</OPTION> <OPTION value=125>Zimbabwe
- Harare [GMT +01:00]</OPTION></SELECT> </TD></TR>
<span style="font-family:Verdana,sans-serif; font-size:9pt <TR>
<span style="font-family:Verdana,sans-serif; font-size:9pt <TD align=right>&nbsp;</TD>
<span style="font-family:Verdana,sans-serif; font-size:9pt <TD><INPUT name=Submit value=Register type=submit></TD></TR></TBODY></TABLE>

<p style="line-height:normal; margin-bottom:0pt <span style="font-family:Verdana,sans-serif; font-size:9pt if I tried OF<span style="font-family:Consolas; font-size:9.5pt orm.SetAttribute(<span style="color:#a31515 "<span style="font-family:Verdana,sans-serif; font-size:9pt username_reg<span style="color:#a31515; font-family:Consolas; font-size:9.5pt
"<span style="font-family:Consolas; font-size:9.5pt , RegisterData.UserData.Username);
<p style="line-height:normal; margin-bottom:0pt
<span style="font-family:Verdana,sans-serif; font-size:9pt there is an exception
<span style="font-family:Verdana,sans-serif; font-size:9pt Member not found. (Exception from HRESULT: 0x80020003 (DISP_E_MEMBERNOTFOUND))
<span style="font-family:Verdana,sans-serif; font-size:9pt Any one has any idea what to do?


View the full article
 
Back
Top