Welcome, Guest
Username: Password: Remember me

TOPIC: [SOLVED] formGroup and Server-side Validation

formGroup and Server-side Validation 18 Jul 2013 23:44 #10521

  • Tomaselli
  • Tomaselli's Avatar
  • Offline
  • Elite Member
  • Posts: 293
  • Thank you received: 87
  • Karma: 46
Hi Admin,
How can I manage the server-side validation on a field like this?:
		<field name="tax"
				label="MY_COMPONENT_FIELD_TAX"
				alias="tax"
				filter="FLOAT"
				required="true"
				class="validate[custom[decimal5to2]]"
				validate="decimal5to2"
				formGroup="extra_options"
				formControl="jform"
				type="cktext"/>

firstly the formGroup and formControl seem to do not be passed to Jdom, I solved that.....but the problem is on the server side validation of the simple "required".
the field is recognized by joomla as jform[tax] and not as jform[extra_options][tax], so submitting the form will always give the error of missing field.
Any suggestion/workaround is welcome.
thanks.


I solved it writing the xml form in the correct way, joomla will manage it correctly. my mistake was to use the fields (successively stored as JSON object), without using the <fields></fields> tag. using the <fields/> tag joomla/jdom will manage it correctly, and the input name will be in this case: jform[extra_options][tax]
and everything will work fine also for the server-side validation.
<fields name="extra_options">	
	<fieldset name="itemview.extraoptions"
			addfieldpath="/administrator/components/com_mycomponent/models/fields"
			label="MY_COMPONENT_JFORM_EXTRA_OPTIONS">

		<field name="tax"
				label="MY_COMPONENT_FIELD_TAX"
				alias="tax"
				filter="FLOAT"
				required="true"
				class="validate[custom[decimal5to2]]"
				validate="decimal5to2"
				type="cktext"/>
	</fieldset>
</fields>
Last Edit: 24 Jul 2013 17:19 by Tomaselli.
The administrator has disabled public write access.
Time to create page: 0.219 seconds

Get Started