Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Frederik T 234 posts 345 karma points
    Nov 11, 2011 @ 11:20
    Frederik T
    0

    Simple and stupid question

    Im at a loss, for something so simple i dont know if my brain decided to not help me or what.

    Its really simple, i have some checkboxes, a textfield and a button in a template. User writes something in the box, checks a few boxes, and triggers a macro with the values sent to the macro's parameters. (Yes you guessed it, its a custom search function).

    So, how? How can i fire the macro with a button? And how do i put the values from the checkboxes and textbox in its parameters?

    Is it easier to dump it all in the xslt and have it handle everything?

  • Rich Green 2246 posts 4008 karma points
    Nov 11, 2011 @ 12:00
    Rich Green
    0

    Hey Frederik,

    There's probably many ways to solve this issue, but one would be to 'create' a standard html form with submit button within your xslt form, then just post to another page and deal with the form here, or if you want it on the same page just check to see if you have any request.form values and deal with it accordingly.

    Pretty much the same as you would with straight html.

    Rich

  • Frederik T 234 posts 345 karma points
    Nov 11, 2011 @ 12:41
    Frederik T
    0

    Thanks for your time for such a simple question, my brain hasnt started functioning. Ive made a form that submits a GET to a new page that has the macro, which takes the values from the values appended to the url from the get. Only problem is, for some reason it wont, it only sends he value of the submit button, or just nothing at all. Odd indeed.

    Man, i must be tired if i cant figure this one out.

    <form action="/studie/legater/soegeresultat.aspx" method="get">
                <table width="100%">
                  <tr>
                    <td colspan="3">
                      <h3 style="margin-bottom: 10px; padding-top: 5px;">Evt. legatnavn&nbsp;&nbsp;&nbsp;<input type="text" id="keyword"></h3>
                    </td>
                  </tr>
                  <tr>
                    <td style="width: 33%;" valign="top">
                      <h3>Uddannelsesretning</h3>
                      <input type="checkbox" id="typeid" value="8" />Håndværk, Landbrug, Gartner etc.<br />
                      <input type="checkbox" id="typeid" value="6" />Humaniora, Teologi &amp; Lærerstuderende<br />
                      <input type="checkbox" id="typeid" value="4" />Kunst &amp; Kultur<br />
                      <input type="checkbox" id="typeid" value="9" />Legater uden specifik studieretning<br />
                      <input type="checkbox" id="typeid" value="3" />Naturvidenskab<br />
                      <input type="checkbox" id="typeid" value="1" />Samfundsvidenskab, Jura, Økonomi, Han...<br />
                      <input type="checkbox" id="typeid" value="5" />Sundhedsvidenskab &amp; Sygeplejer<br />
                      <input type="checkbox" id="typeid" value="2" />Tekniske Uddannelser<br />
                      <input type="checkbox" id="typeid" value="7" />Ungdomsuddannelser
                    </td>   
                    <td>
                      <h3>Formål</h3>
                      <input type="checkbox" id="purposeid" value="5" />Forskning<br />
                      <input type="checkbox" id="purposeid" value="6" />Projekter og sociale aktiviteter<br />
                      <input type="checkbox" id="purposeid" value="2" />Studerende i særlig økonomisk vanskelighed<br />
                      <input type="checkbox" id="purposeid" value="1" />Studier og arbejde i udlandet<br />
                      <input type="checkbox" id="purposeid" value="3" />Værdigt trængende studerende<br />
                      <input type="checkbox" id="purposeid" value="4" />Videreuddannelse
                    </td>
                    <td>   
                      <h3>Ansøgningsfrist</h3>
                      <input type="checkbox" id="month" value="1,2,3" />1. kvartal<br />
                      <input type="checkbox" id="month" value="4,5,6" />2. kvartal<br />
                      <input type="checkbox" id="month" value="7,8,9" />3. kvartal<br />
                      <input type="checkbox" id="month" value="10,11,12" />4. kvartal
                    </td>
                  </tr>
                  <tr>
                    <td width="50%" valign="top">
                      <input id="submit" name="submit" type="submit" value="Submit" class="submit" />
                     
                    </td>
                  </tr>
                </table>
              </form>

  • Rich Green 2246 posts 4008 karma points
    Nov 11, 2011 @ 12:56
    Rich Green
    0

    Hey,

    There's nothing wrong with your form as far as I can see.

    Have you tried just putting it directly in a template (rather than xslt) just to test?

    Rich

  • Frederik T 234 posts 345 karma points
    Nov 11, 2011 @ 13:00
    Frederik T
    0

    What you see there is in a template. When i press submit it puts the submit buttons value in the ur like so:


    www.mysite.com/studie/legater/soegeresultat.aspx?submit=Submit.


    I have no idea why it does that. Even if the macro in the receiving page doesnt work (though it looks like it does), the values should still be appended regardless. It doesnt really make any sense.

  • Rich Green 2246 posts 4008 karma points
    Nov 11, 2011 @ 13:03
    Rich Green
    0

    What does the following get you?

    <form name="input" action="/studie/legater/soegeresultat.aspx" method="get">
    Test: <input type="text" name="test" />
    <input type="submit" value="Submit" />
    </form>
     
    Rich

  • Frederik T 234 posts 345 karma points
    Nov 11, 2011 @ 13:07
  • Rich Green 2246 posts 4008 karma points
    Nov 11, 2011 @ 13:46
    Rich Green
    1

    Hey,

    I would add your pieces of code in bit by bit and see when it causes a problem

    Rich

  • Frederik T 234 posts 345 karma points
    Nov 11, 2011 @ 13:55
    Frederik T
    0

    Yeah, just did that, and realized something incredibly stupid. Remember i said my brain wasnt functioning? Well, it decided to boot up and i saw a complete ultimate rookie mistake.

    i gave all the fields "id" instead of "name". Man, what was a i thinking? Needles to say, it works now. So thank you for your time, i appreciate you for helping me with such a silly thing.

  • Rich Green 2246 posts 4008 karma points
    Nov 11, 2011 @ 13:56
    Rich Green
    0

    Hey,

    Glad I could help, we all have these days, sometimes you just need to talk it through :)

    Rich

     

Please Sign in or register to post replies

Write your reply to:

Draft