public function validateName() { $input = JFactory::getApplication()->input; $componentName = trim(JRequest::getVar('componentName', '')); if (preg_match('#([^a-zA-Z0-9_ ])#', $componentName) || empty($componentName) || $componentName == 'elements') { echo '0|' . JText::_('RSFP_UNIQUE_NAME_MSG'); $this->close(); } //on file upload component, check destination $componentType = $input->getInt('componentType'); if ($componentType == 9) { $destination = JRequest::getVar('destination'); $destination = RSFormProHelper::getRelativeUploadPath($destination); if (empty($destination)) { echo '2|' . JText::_('RSFP_ERROR_DESTINATION_MSG'); $this->close(); } if (!is_dir($destination)) { echo '2|' . JText::_('RSFP_ERROR_DESTINATION_MSG'); $this->close(); } if (!is_writable($destination)) { echo '2|' . JText::_('RSFP_ERROR_DESTINATION_WRITABLE_MSG'); $this->close(); } } $currentComponentId = $input->getInt('currentComponentId'); $componentId = $input->getInt('componentId'); $formId = $input->getInt('formId'); $exists = RSFormProHelper::componentNameExists($componentName, $formId, $currentComponentId); if ($exists) { echo '0|' . JText::_('RSFP_UNIQUE_NAME_MSG'); } else { echo 'Ok'; } $this->close(); }