Jump to content

Creating a custom form


slymatt

Recommended Posts

Hello,

 

So im trying to create a custom form, i want the name then input box that is grayed out then a button,

 

Up to now i have the name and input box grayed out but im not sure how to put a button next to it, i am getting each category from the database in a foreach loop and need a button next to the input to allow me to open a new popup window for the user to select something on that page and pass it back to the previous page to populate the input box.

 

I hope this make sense.

 

This is the current input code i  have:


		$fields_form[0]['form'] = array(
			'legend' => array(
				'title' => $this->l('Settings'),
			),
			'input' => array(),
			'submit' => array(
				'title' => $this->l('Save'),
				'class' => 'button'
			)
		);
		$AuthKey = array('type' => 'text',
						'label' => $this->l('Authentication Key'),
						'name' => 'MYMODULE_NAME',
						'size' => 20,
						'disabled' => 'disabled',
						'required' => true
						);
						
		$options = array(
					  array(
						'id_option' => 1,                 // The value of the 'value' attribute of the <option> tag.
						'name' => 'ARG'              // The value of the text content of the  <option> tag.
					  ),
					  array(
						'id_option' => 2,
						'name' => 'BRAZ'
					  ),
					);
					
		$Location = array(
							  'type' => 'select',                              // This is a <select> tag.
							  'label' => $this->l('Listing Location:'),         // The <label> for this <select> tag.
							  'desc' => $this->l(''),  // A help text, displayed right next to the <select> tag.
							  'name' => 'listing_location',                     // The content of the 'id' attribute of the <select> tag.
							  'required' => true,                              // If set to true, this option must be set.
							  'options' => array(
								'query' => $options,                           // $options contains the data itself.
								'id' => 'id_option',                           // The value of the 'id' key must be the same as the key for 'value' attribute of the <option> tag in each $options sub-array.
								'name' => 'name'                               // The value of the 'name' key must be the same as the key for the text content of the <option> tag in each $options sub-array.
							  )
							);
						
		
			array_push($fields_form[0]['form']['input'], $AuthKey, $MercadoLocation); 

		foreach ($categorys as $category)
		{
			$next = array('type' => 'text',
						'label' => $this->l($category['name']),
						'name' => 'MYMODULE_NAME',
						'size' => 20,
						'disabled' => 'disabled',
						'required' => true
						);
			array_push($fields_form[0]['form']['input'], $next); 
		}
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...