Copied to clipboard

Flag this post as spam?

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


  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Feb 07, 2011 @ 17:35
    Jan Skovgaard
    0

    Getting values from form collection using get

    Hi

    I'm currently have problems figuring out how I can get access to the whole form collection when using "GET" as the method.

    For instance I have this

    <form name="mycatalogue-1" method="get" action="">

    <select name="mit-katalog-{id}">
    <option value="">Vælg liste</option>
    <option value="1">value 2</option>
    <option value="2">value 2</option>
    </select>
    <input name="gem" type="submit" value="Gem" />
    </form>

    I'm having multiple forms on the same page and I only need to update on of them on submit.

    Therefore I need to be able to fetch and manipulate the collection but I just can't remember how that is done using XSLT or if I would nee an extension for this?

    Cheers

    /Jan

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Feb 07, 2011 @ 17:58
    Chriztian Steinmeier
    1

    Form results from a GET should end up in the QueryString... Tried the RequestQueryString() method? Though I don't think you can get the collection - only named keys... /Chriztian

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Feb 07, 2011 @ 19:33
    Jan Skovgaard
    0

    Hi Chriztian

    Thanks for your reply.

    I'm just using Request() but should do the same trick, right?

    My problem is that I'm having more lists, wrapped up in <select>'s - so they're rendered dynamically making the names unique like "mit-katalog-23902", "mit-katalog-9323" etc.

    I need to have unique names to make sure that I fetch only the value of a specifc <select> - But I can't seem to figure on how to achieve it - the solution I was thinking about involved using the RequestServerVariables(' QUERY_STRING') in combination with using "GET" as posting method. (This was, what I could'nt remember in the first post) - But this does not seem to be the answer either.

    I hope this makes sense?

    Any inputs are very much welcome.

    Cheers.

    /Jan

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Feb 07, 2011 @ 21:25
    Tom Fulton
    1

    Hi Jan,

    I might be misunderstanding, but to get a specific input couldn't you do something like

    RequestQueryString(concat('mit-katalog-',$selectid))

    Will you know the unique portion of the select?  If not and they are each in their own form tags perhaps you could add a hidden input to store it? 

    <input type="hidden" name="selectid" value="{id}"/>

    RequestQueryString(concat('mit-katalog-',RequestQueryString('selectid')))

    Sorry if this is off base, a little confused as to exactly what you are asking :)

    Thanks,
    Tom

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Feb 07, 2011 @ 22:40
    Jan Skovgaard
    0

    Hi Tom

    I'm not sure the suggested would work, even though it makes sense to me why you're thinking this way. It was a bit of what I thought about myself. But actually it turns out to be quite simple what I needed to do (it always is, right? :))

    I needed to use POST and then add a parameter to the action attribute containing the id of the product and then compare the id in the parameter with the one from the XSLT - If they match update the list with this exact product. This triggers the actual list and not all of them, which was my problem. Just one of those days where nothing makes sense I guess :-)

    A short example on what I ended up doing...the html

    <form name="productlist" action="?id=id" method="post">

    <select name="mit-katalog">
    <option value="1">List 1</option>
    <option value="2">List 2</option>
    </select>

    <input type="submit" name="save-list" value="Gem" />

    </form>

    (Imagine a couple more of the above forms)

    And then in the XSLT I make this test

    <xsl:if test="umbraco.library:Request('id') = id">
    <!-- update code goes here -->
    </xsl:if>

    I hope the above makes sense - really relieved to get it solved though :-)

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft