katelynnm 1 Posted October 30, 2013 Report Share Posted October 30, 2013 Within a loop, I'm using "$next list item" to type into an input box from a list. This causes the item to have a comma at the end of it. Example: "dog," How can I hit backspace to delete the comma before moving on with my script? I have tried typing {BK} and {Backspace} into the "Text to Type" field following the "$next list item", but that doesn't work. For reference, I have pro version 4.Thanks. Quote Link to post Share on other sites
HelloInsomnia 1103 Posted October 30, 2013 Report Share Posted October 30, 2013 Just do a $replace and put the comma in the field and replace it with $nothing. Quote Link to post Share on other sites
katelynnm 1 Posted October 30, 2013 Author Report Share Posted October 30, 2013 Hi! I just tried it but it didn't work-here are the two ways I tried it: Attempt 1: set(#removecomma, $replace($next list item(%searchterms), ",", $nothing), "Global") type text(<id="search-home-input">, $next list item(%searchterms), "Standard") Attempt 2: type text(<id="search-home-input">, $next list item(%searchterms), "Standard") set(#removecomma, $replace("<id=search-home-input>", ",", $nothing), "Global") Quote Link to post Share on other sites
Steve 30 Posted October 30, 2013 Report Share Posted October 30, 2013 Is the comma coming from the actual list, or is it the website adding the comma from javascript after you type in the box? Quote Link to post Share on other sites
Steve 30 Posted October 30, 2013 Report Share Posted October 30, 2013 Hi! I just tried it but it didn't work-here are the two ways I tried it: Attempt 1: set(#removecomma, $replace($next list item(%searchterms), ",", $nothing), "Global") type text(<id="search-home-input">, $next list item(%searchterms), "Standard") Attempt 2: type text(<id="search-home-input">, $next list item(%searchterms), "Standard") set(#removecomma, $replace("<id=search-home-input>", ",", $nothing), "Global") You were close with attempt one. The only thing you did wrong was not type the new variable you just created, you typed the same old list item.Should have been set(#removecomma, $replace($next list item(%searchterms), ",", $nothing), "Global") type text(<id="search-home-input">, #removecomma, "Standard") But... you could also simplify it by doing one line of code: type text(<id="search-home-input">, $replace($next list item(%searchterms), ",", $nothing), "Standard") Quote Link to post Share on other sites
katelynnm 1 Posted October 30, 2013 Author Report Share Posted October 30, 2013 It's coming from the list. If I do the type text with a specific word instead of $next list item it doesn't add in the commas. Quote Link to post Share on other sites
YuraB 4 Posted October 31, 2013 Report Share Posted October 31, 2013 Have you tried use empty quotations "" instead of $nothing? You can also try $eval math function to use JavaScript replace functionality. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.