Guest vince Report post Posted March 21, 2012 Hi All I'm entirely new to wapt. I want to add post parameters to a wapt request dynamically based on the response from previous request. How is it possible? Thanks in advance Vince Quote Share this post Link to post Share on other sites
sergei 0 Report post Posted March 21, 2012 Hi All I'm entirely new to wapt. I want to add post parameters to a wapt request dynamically based on the response from previous request. How is it possible? Thanks in advance Vince Do you want to add a post parameter with a new name or modify a value of some old one? Quote Share this post Link to post Share on other sites
Guest vince Report post Posted March 21, 2012 Hi Sergei I want to add a new POST parameter. Quote Share this post Link to post Share on other sites
Guest vince Report post Posted March 21, 2012 Hi I will explain a scenario. I have a sales order page and it got a grid. According to the user entry the grid may contain any number of items/rows. Say first time it may have 10 items, second time it may have 20 items. So i need to parameterize all the parameters associated with this grid. How can I do that? Thanks Vince Quote Share this post Link to post Share on other sites
Guest vince Report post Posted March 22, 2012 As an Example consider a Sales Order or and Invoice. The NUmber of Items is most of the times DYNAMIC. It could be 5 Itesm one time and 10, 15, etc... items in other cases. The Name Value pairs handling these will be usually numberred sequentially like: 1. Name = ItemName01, Value = ItemValue01 2. Name = ItemName02, Value = ItemValue02 3. Name = ItemName03, Value = ItemValue03 4. Name = ItemName04, Value = ItemValue04 5. Name = ItemName05, Value = ItemValue05 6. Name = ItemName06, Value = ItemValue06 n. Name = ItemName0n, Value = ItemValue0n Is tehre any means by which the Name value pairs can be formed dynamically in realtime? Java Sctipt could be one solution, how could we access teh DOM of the previous request? regards, Vince Quote Share this post Link to post Share on other sites
sergei 0 Report post Posted March 22, 2012 You can create POST request with POST parameters type "Text" and use a variable in request body. Before POST request you should create JavaScript operator and initialize a value of the variable in JavaScript. Quote Share this post Link to post Share on other sites
Guest vince Report post Posted March 22, 2012 Hi Sergei I tried with "POST Parameters Type" as "Text" in "POST Parameters" tab without using any javascript, just harcoded POST parameter values. But it is not working!! Quote Share this post Link to post Share on other sites
sergei 0 Report post Posted March 23, 2012 Hi Sergei I tried with "POST Parameters Type" as "Text" in "POST Parameters" tab without using any javascript, just harcoded POST parameter values. But it is not working!! You need to use JavaScript operator to generate POST parameters. Quote Share this post Link to post Share on other sites
Guest vince Report post Posted March 26, 2012 Hi Sergei Thanks a lot for your help. Really appreciate it. Can you please provide a sample example? Vince Quote Share this post Link to post Share on other sites
sergei 0 Report post Posted March 26, 2012 Hi Sergei Thanks a lot for your help. Really appreciate it. Can you please provide a sample example? Vince See an attached example Example.wpp Quote Share this post Link to post Share on other sites
kingsubbarao1 0 Report post Posted June 12, 2012 I have a similar scenario where my first page itself is a request that contains numbers that randomly change. I used your example file and i initialized the javascript before page1 and gave a value1. I declared the value1 in initial variables but when i verify it, the script still fails saying value1 is not found. Can you please help? I attached screenshot of my issue if that helps. Quote Share this post Link to post Share on other sites
sergei 0 Report post Posted June 14, 2012 If you want to use WAPT variable from JavaScript you should use method: context.variable("var_name") - gets/sets the value of the "var_name" variable; Quote Share this post Link to post Share on other sites