Select Radio button remove Text in HTML

Support for iMacros. The iMacros software is the unique solution for automating every activity inside a web browser, for data extraction and web testing.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
Tamilselvan
Posts: 129
Joined: Mon Mar 07, 2016 10:49 am

Select Radio button remove Text in HTML

Post by Tamilselvan » Tue Nov 01, 2022 3:53 am

Firefox 52.9.0 (32-bit)
iMacros 8.9.7
Win-10 (64-bit)
Hi,


I am filling date to employee which they have Aadhar Number. Some employee Aadhar Number is not verified, So Manually I select the Radio Button "No" option then go to HTML page remove text ' disabled="disabled" ' then i fill date...

How to automate this task...Kindly help me...

Code: Select all

TAG POS=1 TYPE=SPAN ATTR=ID:ctl00_ContentPlaceHolder1_gvData_ctl*_job&&TXT:*{{App_Name}}*

TAG POS=R1 TYPE=INPUT:TEXT ATTR=ID:ctl00_ContentPlaceHolder1_gvData_ctl*_dt_app CONTENT=03/11/2022
TAG POS=R1 TYPE=INPUT:TEXT ATTR=ID:ctl00_ContentPlaceHolder1_gvData_ctl*_dt_from CONTENT=03/11/2022

TAG POS=R1 TYPE=INPUT:TEXT ATTR=ID:ctl00_ContentPlaceHolder1_gvData_ctl*_d3 CONTENT=6
'TAG POS=R1 TYPE=INPUT:TEXT ATTR=ID:ctl00_ContentPlaceHolder1_gvData_ctl*_d3 CONTENT={{!COL7}}
'WAIT SECONDS=1
TAG POS=R1 TYPE=INPUT:TEXT ATTR=ID:ctl00_ContentPlaceHolder1_gvData_ctl*_dt_to CONTENT=09/11/2022


TAG POS=R1 TYPE=INPUT:RADIO FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_gvData_ctl*_rbnAadhar_1


ONDIALOG POS=1 BUTTON=OK CONTENT=
ONDIALOG POS=2 BUTTON=OK CONTENT=
TAG POS=1 TYPE=INPUT:SUBMIT ATTR=ID:ctl00_ContentPlaceHolder1_btnProceed
' If Aadhar not verified

Code: Select all

TAG POS=1 TYPE=INPUT:RADIO FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_gvData_ctl02_rbnAadhar_1

Code: Select all

<span disabled="disabled">
<input id="ctl00_ContentPlaceHolder1_gvData_ctl03_rbnAadhar_1" name="ctl00$ContentPlaceHolder1$gvData$ctl03$rbnAadhar" value="N" disabled="disabled" onclick="javascript:setTimeout('__doPostBack(\'ctl00$ContentPlaceHolder1$gvData$ctl03$rbnAadhar$1\',\'\')', 0)" type="radio"><label for="ctl00_ContentPlaceHolder1_gvData_ctl03_rbnAadhar_1">No</label></span>
Before
Before
After
After
Regards,
S.Tamilselvan
chivracq
Posts: 10301
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Select Radio button remove Text in HTML

Post by chivracq » Tue Nov 01, 2022 9:59 am

Tamilselvan wrote:
Tue Nov 01, 2022 3:53 am
Firefox 52.9.0 (32-bit)
iMacros 8.9.7
Win-10 (64-bit)
Hi,


I am filling date to employee which they have Aadhar Number. Some employee Aadhar Number is not verified, So Manually I select the Radio Button "No" option then go to HTML page remove text ' disabled="disabled" ' then i fill date...

How to automate this task...Kindly help me...

Code: Select all

TAG POS=1 TYPE=SPAN ATTR=ID:ctl00_ContentPlaceHolder1_gvData_ctl*_job&&TXT:*{{App_Name}}*

TAG POS=R1 TYPE=INPUT:TEXT ATTR=ID:ctl00_ContentPlaceHolder1_gvData_ctl*_dt_app CONTENT=03/11/2022
TAG POS=R1 TYPE=INPUT:TEXT ATTR=ID:ctl00_ContentPlaceHolder1_gvData_ctl*_dt_from CONTENT=03/11/2022

TAG POS=R1 TYPE=INPUT:TEXT ATTR=ID:ctl00_ContentPlaceHolder1_gvData_ctl*_d3 CONTENT=6
'TAG POS=R1 TYPE=INPUT:TEXT ATTR=ID:ctl00_ContentPlaceHolder1_gvData_ctl*_d3 CONTENT={{!COL7}}
'WAIT SECONDS=1
TAG POS=R1 TYPE=INPUT:TEXT ATTR=ID:ctl00_ContentPlaceHolder1_gvData_ctl*_dt_to CONTENT=09/11/2022

TAG POS=R1 TYPE=INPUT:RADIO FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_gvData_ctl*_rbnAadhar_1

ONDIALOG POS=1 BUTTON=OK CONTENT=
ONDIALOG POS=2 BUTTON=OK CONTENT=
TAG POS=1 TYPE=INPUT:SUBMIT ATTR=ID:ctl00_ContentPlaceHolder1_btnProceed
' If Aadhar not verified

Code: Select all

TAG POS=1 TYPE=INPUT:RADIO FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_gvData_ctl02_rbnAadhar_1

Code: Select all

<span disabled="disabled">
<input id="ctl00_ContentPlaceHolder1_gvData_ctl03_rbnAadhar_1" name="ctl00$ContentPlaceHolder1$gvData$ctl03$rbnAadhar" value="N" disabled="disabled" onclick="javascript:setTimeout('__doPostBack(\'ctl00$ContentPlaceHolder1$gvData$ctl03$rbnAadhar$1\',\'\')', 0)" type="radio"><label for="ctl00_ContentPlaceHolder1_gvData_ctl03_rbnAadhar_1">No</label></span>
Aadhar Disabled.jpg
After removed text.jpg

Regards,
S.Tamilselvan

Okay..., alright, that's pretty "Advanced Stuff" you are doing "now", I'm rather impressed, ah-ah...! :wink: :o

OK, I'm not really-really knowledgeable with this part of Web-Automation and HTML/JS Injection (because I don't use it for myself...! :P ), but I think you need the JS `Element` Method `removeAttribute()` for the Func that you want... :idea:

=> From the Example on that MDN Page, try this...:

Code: Select all

URL GOTO=javascript:document.getElementById("ctl00_ContentPlaceHolder1_gvData_ctl03_rbnAadhar_1").removeAttribute("disabled");
And hum..., a few Remarks...:
1- I "see" a lot of 'R-POS' in your Script, which lets me "believe" that you might have several Rows in that Table as you are using the 'Name of Applicant' Field as Anchor for 'Relative Positioning' to make sure all further Statements/Commands will apply to next Fields on that same Row, but if you have several Rows, the `URL GOTO=javascript:etc...` Statement/Command I posted (if the Syntax is correct, and if it ueberhaupt works, of course...!), will be applied to the 1st Row in the Table, a bit like a "TAG POS=1".

So if you have several Rows, then (I think...?) you would need to adapt that Statement to:

Code: Select all

URL GOTO=javascript:document.getElementById("ctl00_ContentPlaceHolder1_gvData_ctl03_rbnAadhar_1")[n].removeAttribute("disabled");
... with "n" being the Row_Nb, just like "TAG POS=n".
... And you cannot use 'R-POS' with the JS `getElementById()`... :(

But...!, just like the `EVENT` Mode also doesn't support 'R-POS', I have some kind of (Advanced) Workaround...! :twisted: :P , for which you would need to extract the whole Table (with 'EXTRACT=HTM') to compute that "n" by "calculating" (with `EVAL()`) the Row_Nb of the Row you want to handle... :idea:

2- I didn't really understand how you "decide" or can recognize that an 'Aadhar Employee Number' is "not verified", but if you can extract some HTML Element specific for when that Employee_Nb is not verified, then using `EVAL()` again, you could make that `URL GOTO=javascript` Line even Conditional by passing the ID of the `iNPUT` Element for example as a Var, or some "fake" ID that won't be found if you want the Line to do nothing, as I think(...?), the `URL GOTO=javascript` Syntax supports iMacros Vars, like in for example...:

Code: Select all

SET Aadhar_ID ctl00_ContentPlaceHolder1_gvData_ctl03_rbnAadhar_1
SET !EXTRACT NULL
TAG POS=1 TYPE=SPAN ATTR=ID:*&&TXT:Not<SP>verified EXTRACT=TXT
SET Disable_Verified EVAL("var s='{{!EXTRACT}}', id='{{Aadhar_ID}}'; var z; if(s!='#EANF#'){z=id;} else{z='fake_id';}; z;")
'URL GOTO=javascript:document.getElementById("ctl00_ContentPlaceHolder1_gvData_ctl03_rbnAadhar_1").removeAttribute("disabled");
URL GOTO=javascript:document.getElementById("{{Disable_Verified}}").removeAttribute("disabled");
(Not tested of course, you will need to adapt a few parts, it's to give an Example for the "Principle"...)

Or if you need the "[n]" Syntax because of several Rows, you could compute and pass that "n" Value instead, with 'n' = "1"/"2"/"3" the real Value, or 'n' = "0" or "99" instead of a fake ID... :idea:
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE'/'Trial').
- FCI not mentioned: I don't even read the Qt...! (or only to catch Spam!)
- Script & URL help a lot for more "educated" Help...
Tamilselvan
Posts: 129
Joined: Mon Mar 07, 2016 10:49 am

Re: Select Radio button remove Text in HTML

Post by Tamilselvan » Tue Nov 01, 2022 4:32 pm

Thank You for your valuable reply :D
But it is not Inject the HTML/JS

Code: Select all

TAG POS=1 TYPE=SPAN ATTR=ID:ctl00_ContentPlaceHolder1_gvData_ctl*_job&&TXT:*{{App_Name}}*


TAG POS=R1 TYPE=INPUT:TEXT ATTR=ID:ctl00_ContentPlaceHolder1_gvData_ctl*_dt_app CONTENT=03/11/2022
TAG POS=R1 TYPE=INPUT:TEXT ATTR=ID:ctl00_ContentPlaceHolder1_gvData_ctl*_dt_from CONTENT=03/11/2022

TAG POS=R1 TYPE=INPUT:TEXT ATTR=ID:ctl00_ContentPlaceHolder1_gvData_ctl*_d3 CONTENT=6
'TAG POS=R1 TYPE=INPUT:TEXT ATTR=ID:ctl00_ContentPlaceHolder1_gvData_ctl*_d3 CONTENT={{!COL7}}
'WAIT SECONDS=1
TAG POS=R1 TYPE=INPUT:TEXT ATTR=ID:ctl00_ContentPlaceHolder1_gvData_ctl*_dt_to CONTENT=09/11/2022


TAG POS=R1 TYPE=INPUT:RADIO FORM=ID:aspnetForm ATTR=ID:ctl00_ContentPlaceHolder1_gvData_ctl02_rbnAadhar_1
URL GOTO=javascript:document.getElementById("ctl00_ContentPlaceHolder1_gvData_ctl02_rbnAadhar_1")[n].removeAttribute("disabled");
ID is differ it depends on row :!:
id="ctl00_ContentPlaceHolder1_gvData_ctl02_rbnAadhar_1"
id="ctl00_ContentPlaceHolder1_gvData_ctl03_rbnAadhar_1"
id="ctl00_ContentPlaceHolder1_gvData_ctl04_rbnAadhar_1"
Below code is not execute / Inject

Code: Select all

URL GOTO=javascript:document.getElementById("ctl00_ContentPlaceHolder1_gvData_ctl02_rbnAadhar_1")[n].removeAttribute("disabled");
After removed text-2.jpg

Please guide me...
Tamilselvan
Posts: 129
Joined: Mon Mar 07, 2016 10:49 am

Re: Select Radio button remove Text in HTML

Post by Tamilselvan » Tue Nov 08, 2022 1:58 pm

Kindly anyone solve this issue
Post Reply