We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26503
    • 620 Posts
    I've got this little plugin almost note for note from here: http://rtfm.modx.com/revolution/2.x/case-studies-and-tutorials/adding-custom-fields-to-manager-forms

    It does work, gets & sets the TVValue I need it to,


    <?php
    
    $id = isset($_REQUEST['id']) ? $_REQUEST['id'] : 0;
    
    $resource = $modx->getObject('modResource', $id);
    
    $fields = '';
    
    switch ($modx->event->name) {
    
        case 'OnDocFormPrerender':
    	// nothing to do here
    
    	break;
    
    
        case 'OnDocFormRender':
    
            $value = '';
    
          	$value = $resource->getTVValue('keywords');
    
            $fields = '<div class="x-form-item x-tab-item">
    			<label class="x-form-item-label" style="width:auto;">Keywords</label>
    			<div class="x-form-element">
    				<input type="text" name="keywords" value="'.$value.'"
     class="x-form-text x-form-field"  style="width:auto;"/>
    			</div>
    		</div>';
    
            $modx->event->output($fields);
    
    	break;
    
    
        case 'OnDocFormSave':
            
    		$resource->setTVValue('keywords', $_POST['keywords']);
    
        break;
    }
    
    return;



    **HOWEVER**

    It does a couple weird things, looking at the attached file,

    i. It adds a path above the form field label. ~ no idea where that is coming from or how it got there. How do I get rid of that? [no errors, modx log or in server log]

    ii. The field itself is of a set length, how do I set it so that it auto-resizes with the rest of the form fields?

    iii. Is it possible to change the order of where it appears on the form? [ideally above description]


      *** Not just websites, we also create signage, banners, print, trade show displays and more! ***

      Sean Kimball CLP, CLS.
      Technical Director / Sr. Developer | BigBlock Studios
      ._______________________________________________.
      Bigblock Studios http://www.bigblockstudios.ca Web site design & development.
      27-1300 King Street East. Box 167 Oshawa, Ontario L1H8J4 Canada.
      phone/fax: 905-426-5525