1

I am trying to integrate HDIV into my existing application. But I am stuck in solving the below problem.

Use Case: 1. I have a big form with huge number of fields. When I change a value in a drop down, I make an Ajax call by passing the selected value as a URL parameter. ex:

  1. $.get("http:://ajaxurl?dynamicParam=1", function(data) {/Render new HTML Content into existing page/});

  2. $.get("http:://ajaxurl?dynamicParam=2", function(data) {/Render new HTML Content into existing page**/}); etc.

Problem: As i select values in the drop down, different values are passed in the ajax param and HDIV throws an INVALID_PARAMETER_VALUE Error.

Only solution I can see is that I need to submit the whole Form with _MODIFIED_HDIV_STATE value.

But, I cant submit the whole form (Which has hell lot of data) in order to pass only one value as part of my Ajax call. Also, I cant exclude the param to bypass HDIV validation as I have the same use case across my application in numerous places.

Is there a way to pass the modified HDIV state as part of the AJAX call as we can do in the FORM submit ? Or please suggest me a way to solve this.

Please help me out to solve this issue. (I am stuck through half way after integrating HDIV into most of my application)

1 Answers1

0

This is a tricky situation. You can be in one of these situations:

  • If you can NOT know in the server side the values of the parameter, you can only define that parameter as a start parameter and skip the validation for that parameter:

if you want to skip the validation for all the views:

<hdiv:startParameters>parameter1</hdiv:startParameters>

if you want to skip the validation for the views you want:

<hdiv:paramsWithoutValidation>
    <hdiv:mapping url="url1" parameters="parameter1" />
</hdiv:paramsWithoutValidation>
  • If you can know in the server side the values of the parameter:

There are two options:

  • Generate all the posible links, one for each value of the parameter and choose by JavaScript the link you want.
  • Do the AJAX call through a form with a parameter. This parameter would be a select with all the posible values. (Recommended option)

I hope it helps.

Fernando Lozano
  • 352
  • 2
  • 11