We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33337
    • 3,975 Posts
    Quote from: jsor at Apr 27, 2009, 02:53 AM

    Quote from: jsor at Apr 24, 2009, 06:19 AM

    Everything is going well except for one thing: how do I keep the right hand side (product list) checkboxes checked if the user doesn’t fill a required field and the form displays an error message? All the info in the form itself (left hand side) stays there but the checkboxes become unchecked.

    Does anyone have any ideas about this? eFormOnValidate?
    This event is used for custom validations.
      Zaigham R - MODX Professional | Skype | Email | Twitter

      Digging the interwebs for #MODX gems and bringing it to you. modx.link
      • 14930
      • 70 Posts
      Quote from: zi at Apr 27, 2009, 03:11 AM

      Quote from: jsor at Apr 27, 2009, 02:03 AM

      zi, thanks for your help, I got it to work. But (as always when you are learning something new) another question arises:

      I also have a dropdown menu next to the checkboxes (the checkbox selects the product, the dropdown allows the user to order multiple articles of the product. Right now I’ve been able to get it to display it in the report like this:

      Product 1, Product 2, Product 3, # of articles for Product 1, # of articles for Product 2, # of articles for Product 3

      But I’d like to get it to display like this:

      Product 1: # of articles, Product 2: # of articles.

      Can this be done?

      I think changing the order in the markup will take care of it.

      eg.
      checkbox code.
      dropdown code
      checkbox2 code
      dropdown2 code

      But I’m only using one chunk as a template for the displayed products, the relevant part as follows:
      <input type="checkbox" name="variableName[]" value="[+longtitle+]: [+pagetitle+]" eform="[+pagetitle+]::1"/> Choose product and select amount: <select name="amount[]" eform="amount">
      <option value="1 kpl">1</option>
      <option value="2 kpl">2</option>
      <option value="3 kpl">3</option>
      etc...
      </select>
      


      And on eFeedbackReport I have [+variableName+] to list the products the user has checked and [+amount+] to list the selected amounts. But I was wondering if I could have them display in the format of Product 1, amount of Product 1, Product X, amount of Product X. I guess its not possible with [+variableName+]?
        • 14930
        • 70 Posts
        Ok, I’m kinda struggling with this again, trying to bend my brain around it, so please bear with me smiley

        I have a dittoed product list with just one template, which looks like this:
        <div id="product">
        		<a name="[+id+]"><div id="product_name" class="text">
        			[+pagetitle+]
        		</div></a>
        
        		<div id="product_number" class="text">
        			[+product_number+]
        		</div>
        
        		<div id="product_image">
        			[+image+]
        		</div>
        		<div id="product_info" class="text">
        			[+content+]
        		</div>
        		<div id="variables" class="text">
        			<input type="checkbox" name="variableName[]" value="[+longtitle+]: [+pagetitle+]" eform="[+pagetitle+]::1"/> 
        Choose product, <input type="text" name="amount[]" maxlength="3" size="3" eform="amount::" /> items.
        		</div>
        </div>


        And in the report I have the following:
        ...
        <tr valign="top"><td>I'd like to order the following products:</td><td>[+variableName+]</td></tr>
        <tr valign="top"><td>Number of items:</td><td>[+amount+]</td></tr>
        ...
        


        The [+variableName+] prints out the products just fine separated by comma and a space, and the same with [+amount+].

        What I’d like to be able to do (now) is to have the products printed like this
        product1
        product2
        etc..
        and that I’m able to do by putting
        in the checkbox tag like this: value="[+longtitle+]: [+pagetitle+]<BR>"

        So fine, now I’m a bit closer to a solution, which is to have BOTH the [+variableName+] AND [+amount+] displayed with line breaks in a two columns next to each other. Like this:

        PRODUCT1         AMOUNT
        PRODUCT2         AMOUNT


        But how can I include
        in [+amount+] variable?

        (Yeah, I could use a dropdown menu with value="[+amount+]
        ", but I was having problems with "extra amounts" with no product selected outputted in the report.)

        Does all this make any sense? Am I doing things the hard way again? grin

        EDIT: Would it work if I used a dropdown menu with blank first value like this
        <option value=""></option>
        <option value="1<br>">1</option>
        ? That would get rid of the "ghost" amounts with no products selected.. Hmm.
          • 7455
          • 2,204 Posts
          You could write a pgh extender for that
          that takes the output and proceses it
          Ditto already supports phx and with a small modification wayfinder will also support phx (I was looking for the treat that somone made that made wayfinder accept phx but I can’t find it sorry)

          Dimmy
            follow me on twitter: @dimmy01
            • 14930
            • 70 Posts
            Thanks for the suggestion, Dimmy. I might have to look into that.

            I got the layout part of it to work with the dropdown menu as I planned, but if the amounts of two different products are the same, it only displays one, not both, thus messing up the layout again.. *sigh* (like in this post and the one linked from this: http://modxcms.com/forums/index.php/topic,34713.0.html )