extra parameter in form

extra parameter in form

aluferrarialuferrari Posts: 22Questions: 1Answers: 0
edited July 2011 in General
We are experiencing a strange issue with data tables.
We have a page that shows data using data tables. When a user selects a row and clicks submit, the form is submitted to next page.
After we added the data tables to this page, the form is showing an additional parameter "datatbl_length" with value "50".

This is actually the current value from value list of "aLengthMenu". If we select to display 100 records in data table and then submit the form, the parameter would have value "100".
When we view the source of the page, this parameter is not available in the html source page.

Our question is:
How can we stop this parameter from adding to the form?

Please help.

Thanks in advance.
- Aluferrari

Replies

  • GregPGregP Posts: 500Questions: 10Answers: 0
    edited July 2011
    Do you have a link we can visit to check the behaviour first-hand?

    I'm going to make a guess that the dataTable is being inserted in-between the tags. If this is the case, the HTML spec says that any input or select elements are sent as part of the form.

    Usually this is completely harmless, though. You can just ignore it on the target page. What sort of problem is it creating in this case?

    If you have a JavaScript event tied to the "submit" or "next" button, you can insert a quick bit of JavaScript to set the value of that select box to "" (empty string). If I'm not mistaken, this input will be ignored when the form is sent forward. Or (again, only if you're willing to use JavaScript) you can set any undesirable input elements to be disabled (in jQuery I believe it is $('#myInput').attr('disabled',true); ).
  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    to stop that, you need to wrap your intended data in tags (else any input element on the entire page will be sent)

    OR

    you could catch onSubmit (i.e. onClick of the button or submission element) and add/remove any params from the submission yourself.
  • aluferrarialuferrari Posts: 22Questions: 1Answers: 0
    edited July 2011
    @GregP & @fbas: Thanks for your suggestions.

    Sorry, it is an intranet application so not accessible outside.

    You were right, the table is between the tags and when the page is submitted, the destination page gives out error saying parameter not found "_Length".
    So, even though we make the value empty, it still gives error because there is an extra parameter which does not have a match on destination page.

    I am passing 3 parameters in form so destination page has 3 parameters to accept. But dataTable adds another parameter "_Length". So this page sends 4 parameters and destination accepts only 3 parameters.

    As a solution, we swapped the tag inside the tag, which resolved the issue.

    Another solution would be to add 4th parameter to the destination page, but this would mean additional work, as this page submits to 5 different pages depending on operation selected by the user.

    Thank you!
  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    edited July 2011
    glad you got it fixed.
This discussion has been closed.