Topic
  • 2 replies
  • Latest Post - ‏2013-10-14T13:38:24Z by GustavBornman
GustavBornman
GustavBornman
2 Posts

Pinned topic Getting values from dynamically create page

‏2013-10-08T09:25:47Z |

Hi guys, im having issues with getting back values from a dynamicaly created page.

The page is a questionnaire, that creates questions and options, using repeat region.

The options can either be single choice (radio buttons), multiple choice (checkboxes), true false (radio buttons), Survey (text input).

My page is generating fine using this XML structure. 

<rowset>
    <row>
      <id>1</id>
      <questionText>This is a single choice question*</questionText>
      <questionType>Single Choice</questionType>
      <possibleAnswerSet>
      <possibleAnswer>Yes</possibleAnswer>
      <possibleAnswer>No</possibleAnswer>
      <possibleAnswer>Maybe</possibleAnswer>
      </possibleAnswerSet>
   </row>
   <row>
      <id>2</id>
      <questionText>This is a survey question</questionText>
      <questionType>Survey</questionType>
      <possibleAnswerSet>
      <possibleAnswer></possibleAnswer>
      </possibleAnswerSet>
   </row>
</rowset>

And my page structure looks like this:

<div>
<table name="surveyTable" id="surveyTable">
<tr name="qRow">
<td>
<table style="margin-bottom: 15px;">
<tr>
<td><span name="qText" class="qTexts"></span></td>
</tr>
<tr>
<td class="qAnswersTD"><span name="qAnswersRadioSC" class="qAnswers"></span><span name="qAnswersRadioTF" class="qAnswers"></span><span name="qAnswersCheck" class="qAnswers"></span><span name="qAnswersText" class="qAnswers"></span></td>
</tr>
</table>
</td>
</tr>
<tr>
<td><span id="submitBtn" name="submitBtn"></span><span id="backBtn" name="backBtn"></span></td>
</tr>
</table>
</div>

My question is, how would I get the values that were selected, to my LJO after submit is clicked, so i could save them.

I have tried: webApp.getRequestInputs().getInputNames();  aswell as getRequestInputs().getInputValues()

with the appropriate tags, with no luck.

Thanks to anyone who could help me wrap my head around this logic

  • mburati
    mburati
    2575 Posts
    ACCEPTED ANSWER

    Re: Getting values from dynamically create page

    ‏2013-10-08T12:47:05Z  

    While there are few cases where one should be using low level builders like repeated region and input control builders,   this may be one of them (where the control type varies from row to row).    The Variable Input Control builder is not a typically used builder but can handle some of these cases where it can choose between Text Input,  Checkbox, Radio Button, Text Area etc based on dynamic data.    I'm not sure what your survey input type is though, so it may not help there.

    If you're doing this for more than one or two models, with the same kind of XML structure and logic, then the most efficient way to make it repeatable may be to create a custom builder that knows how to inspect the data for a row and call the right control builder for that input type.    For getting started or the first model or two you do this in, doing it with the lower level builders can help you figure out what the manual steps are before you try to automate it with a custom builder.

    As far as getting the inputs,  if they are being submitted with the form then you should be able to get them via the RequestInputs.

    I would suggest looking at the generated HTML in the browser and at the form being submitted (eg, with Firebug,  Chrome Debugger or IE Dev Tools) no matter what tool you use to generate the web app, to see what's actually being generated into the page and submitted with the form.

    If you're submitting form data, be sure your inputs are within a form tag and choose "Submit Form and Invoke Action" for the control type (Link or Button) and not "Link to Action", if you're looking for form inputs.

    If checking through all of the above doesn't help then if you could post a simple sample here with no confidential or proprietary information (or intellectual property) then someone may be able to spot what's going on.

     

    I hope that info helps,
    ..Mike Burati 
    The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM.

     

  • mburati
    mburati
    2575 Posts

    Re: Getting values from dynamically create page

    ‏2013-10-08T12:47:05Z  

    While there are few cases where one should be using low level builders like repeated region and input control builders,   this may be one of them (where the control type varies from row to row).    The Variable Input Control builder is not a typically used builder but can handle some of these cases where it can choose between Text Input,  Checkbox, Radio Button, Text Area etc based on dynamic data.    I'm not sure what your survey input type is though, so it may not help there.

    If you're doing this for more than one or two models, with the same kind of XML structure and logic, then the most efficient way to make it repeatable may be to create a custom builder that knows how to inspect the data for a row and call the right control builder for that input type.    For getting started or the first model or two you do this in, doing it with the lower level builders can help you figure out what the manual steps are before you try to automate it with a custom builder.

    As far as getting the inputs,  if they are being submitted with the form then you should be able to get them via the RequestInputs.

    I would suggest looking at the generated HTML in the browser and at the form being submitted (eg, with Firebug,  Chrome Debugger or IE Dev Tools) no matter what tool you use to generate the web app, to see what's actually being generated into the page and submitted with the form.

    If you're submitting form data, be sure your inputs are within a form tag and choose "Submit Form and Invoke Action" for the control type (Link or Button) and not "Link to Action", if you're looking for form inputs.

    If checking through all of the above doesn't help then if you could post a simple sample here with no confidential or proprietary information (or intellectual property) then someone may be able to spot what's going on.

     

    I hope that info helps,
    ..Mike Burati 
    The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM.

     

  • GustavBornman
    GustavBornman
    2 Posts

    Re: Getting values from dynamically create page

    ‏2013-10-14T13:38:24Z  
    • mburati
    • ‏2013-10-08T12:47:05Z

    While there are few cases where one should be using low level builders like repeated region and input control builders,   this may be one of them (where the control type varies from row to row).    The Variable Input Control builder is not a typically used builder but can handle some of these cases where it can choose between Text Input,  Checkbox, Radio Button, Text Area etc based on dynamic data.    I'm not sure what your survey input type is though, so it may not help there.

    If you're doing this for more than one or two models, with the same kind of XML structure and logic, then the most efficient way to make it repeatable may be to create a custom builder that knows how to inspect the data for a row and call the right control builder for that input type.    For getting started or the first model or two you do this in, doing it with the lower level builders can help you figure out what the manual steps are before you try to automate it with a custom builder.

    As far as getting the inputs,  if they are being submitted with the form then you should be able to get them via the RequestInputs.

    I would suggest looking at the generated HTML in the browser and at the form being submitted (eg, with Firebug,  Chrome Debugger or IE Dev Tools) no matter what tool you use to generate the web app, to see what's actually being generated into the page and submitted with the form.

    If you're submitting form data, be sure your inputs are within a form tag and choose "Submit Form and Invoke Action" for the control type (Link or Button) and not "Link to Action", if you're looking for form inputs.

    If checking through all of the above doesn't help then if you could post a simple sample here with no confidential or proprietary information (or intellectual property) then someone may be able to spot what's going on.

     

    I hope that info helps,
    ..Mike Burati 
    The postings on this site are my own and do not necessarily represent the positions, strategies, or opinions of IBM.

     

    Thaks alot Mike, I managed after a week or so struggling to get it all working. Was only needed for one model so a custom builder might have been overkill, but im sure would have worked just as good.