Problem to fill a form with same IDs and dynamic CONTENT

Discussions and Tech Support specific to the iMacros Firefox Add-on.
Forum rules
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
chivracq
Posts: 9018
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Problem to fill a form with same IDs and dynamic CONTENT

Post by chivracq » Sat Sep 23, 2017 4:35 pm

percios wrote:Your precedent macro it seemed perfect but wasn't work, I was going crazy :P but at the end I found the error and thanks to your help I solved and learned something about relative positionig.

The error was in the "third tag" of every "questions"

Not correct code:

Code: Select all

TAG POS=1 TYPE=H1 ATTR=TXT:*Come<SP>si<SP>chiamano<SP>i<SP>Fanfoni
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Blue
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*
Correct code (with the second TAG POS=R1)

Code: Select all

TAG POS=1 TYPE=H1 ATTR=TXT:*Come<SP>si<SP>chiamano<SP>i<SP>Fanfoni
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Blue
TAG POS=R1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*
Without this modify, macro clicked the submit form even if the answer was wrong.

Final code

Code: Select all

SET !TIMEOUT_PAGE 2
SET !ERRORIGNORE YES


TAG POS=1 TYPE=H1 ATTR=TXT:*Come<SP>si<SP>chiamano<SP>i<SP>Patarioti?
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Yellow
TAG POS=R1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*

TAG POS=1 TYPE=H1 ATTR=TXT:*Come<SP>si<SP>chiamano<SP>i<SP>Fanfoni
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Blue
TAG POS=R1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*

TAG POS=1 TYPE=H1 ATTR=TXT:*Come<SP>si<SP>chiamano<SP>i<SP>Nansoni?
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Red
TAG POS=R1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*

TAG POS=1 TYPE=H1 ATTR=TXT:*Come<SP>si<SP>chiamano<SP>i<SP>Tandani?
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Green
TAG POS=R1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*

TAG POS=1 TYPE=H1 ATTR=TXT:*Come<SP>si<SP>chiamano<SP>i<SP>Preteresi?
TAG POS=R1 TYPE=INPUT:TEXT FORM=ID:questioncontainer ATTR=NAME:answer[] CONTENT=Violet
TAG POS=R1 TYPE=INPUT:SUBMIT FORM=ID:questioncontainer ATTR=*
Thank you so much, I'm very happy :D
Without this modify, macro clicked the submit form even if the answer was wrong.
=> Yep of course, that's the Purpose of "Relative Positioning"...

OK, good, one more "Happy Customer", well done...! :D

Some "further Reading" for @OP would be the Wiki Page about "Relative Positioning", I'm not sure you "really" understood how it works and what its "Potential" is, + some Thread where I've explained a few "Applications" for it... (hum, maybe interesting for @techimac as well, if you didn't know it already...):
- Workarounds for Conditional Logic in Macro Code
I explained as well a bit why "I don't like" '.js' Scripts and do everything in pure '.iim'...

Oh...!, and the new Thread Title is much better indeed..., good...! :D
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
techimac
Posts: 311
Joined: Fri Feb 20, 2015 9:27 pm

Re: Problem to fill a form with same IDs and dynamic CONTENT

Post by techimac » Sat Sep 23, 2017 5:30 pm

my code was also correct, I tested it
since questions order were changing every time url is opened
Thats why I used that logic
chivracq
Posts: 9018
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Problem to fill a form with same IDs and dynamic CONTENT

Post by chivracq » Sat Sep 23, 2017 6:25 pm

techimac wrote:my code was also correct, I tested it
since questions order were changing every time url is opened
Thats why I used that logic
Hum..., stupid Qt, @techimac, do you speak Italian...? (And/or what Languages do you speak (a bit correctly)...?)

(I sometimes get "Requests" for (paid) Scripts from Users (on the Forum or SOF or from LinkedIn) who would prefer sbd speaking their native Language, so I sometimes refer them to some other Advanced User(s) from whom I know what Language(s) they speak... (And I don't really speak Italian myself for example, even if I understand it a bit, from being originally French... (and from living for 6 months together with some Flatmate who insisted on speaking only Italian to me, about 20 years ago, was a funny time then, ah-ah...!)) Hum..., and I (or they) would need a way to contact you then a bit quickly and directly, you can send me a Mail for example @ "[My_Pseudo_on_the_Forum]@gmail.com" if you would be interested... Hum..., and same Qt @iimfun as well who's even more "Advanced", ah-ah...! :wink: )
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
chivracq
Posts: 9018
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Problem to fill a form with same IDs and dynamic CONTENT

Post by chivracq » Tue Sep 26, 2017 1:22 am

Hum, @techimac, you can ignore my Qt about Languages from my previous Post, as from this later Thread you seem to be a bit less Advanced User than I thought... :?
OK, I'll ask again in a few years maybe, ah-ah...!
(And I'll be a bit less harsh on you, ah-ah...!, it's nice to have Users answering Threads...)

But hum, Qt would still stand for @iimfun if you notice this Thread... :idea:
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...
Post Reply