We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9241
    • 42 Posts
    I have another issue and I’m not sure how to resolve it...

    I’m using a window with tabs to create objects, now in some of the tab panels there are comboboxes which get’s their values (id and display) from a connector/processor query. This is all fairly standard.

    No problem is when hitting (not literally) save on the window. Under my knowledge of how HTML posts work, when you submit a form with comboboxes the id part of should be sent to the server

    Example:
    <option value="1">One</option>
    <option value="2">Two</option>
    <option value="3">Three</option>
    


    With the above example one would expect the server page to receive either, 1, 2 or 3. But with modx I am see it’s sending One, Two or Three rather than the aforementioned. This is a problem, especially considering I am combining information that is being displayed in CODE - VALUE pairs, now I don’t think I need to split the stuff every time one has to save, as this would just be stupid to then do a getObject(’ObjectClass’, array(’code’ => ’...’, ...)); to find the value...

    The json string which populates the modx-combo widget uses id, name pairs, but for some reason it’s as if the id value is purely for decorative reasons.

    Could somebody please tell me why it’s sending the display value’s value rather than the value field’s value to the server?

    Much appreciated.
      • 28215
      • 4,149 Posts
      Could you post the JS generating your combo?
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 9241
        • 42 Posts
        This is the code for the combobox:
        {
        	xtype: 'modx-combo'
        	,url: DCCart.config.connector_url
        	,baseParams: { action: 'mgr/product/ring/getringstyles' }
        	,resizable: false
        	,fieldLabel: 'Style'
        	,name: 'dccart-panel-ringgeneral-ringstyle'
        }
        
          • 9241
          • 42 Posts
          I’ve been searching endlessly and up to this point haven’t found a solution to the problem sad

          Can somebody possibly provide me with some example code how you would implement the javascript side of a modx-combo widget?
            • 9241
            • 42 Posts
            Finally found my problem laugh I just need to add the hiddenName property.

            {
            	xtype: 'modx-combo'
            	,url: DCCart.config.connector_url
            	,baseParams: { action: 'mgr/product/ring/getringstyles' }
            	,resizable: false
            	,fieldLabel: 'Style'
            	,name: 'dccart-panel-ringgeneral-ringstyle'
            	,hiddenName: 'dccart-panel-ringgeneral-ringstyle'
            }
            


            I’m so happy now! Now I can finally finish the processor’s code to build and save the structure in the database.