OS Property support center

Make country & state required during registration?

  • kalesh.suby
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
11 years 8 months ago #39869 by kalesh.suby
Hi,

How to make country and state and city required fields during Agent registration?

Thanks

Please Log in or Create an account to join the conversation.

More
11 years 8 months ago #39874 by Dang Thuc Dam
Replied by Dang Thuc Dam on topic Re: Make country & state required during registration?
Hi,
If you are using version 2.6, please follow these steps
1. Open file components > com_osproperty > helpers > agentregistration.php
2. find
function submitForm(){
var form = document.ftForm;
var name = form.name;
var email = form.email;
var address = form.address;
var userid = <?php echo intval($user->id)?>;
var captcha_agent_register = form.captcha_agent_register;
<?php
if($user->id > 0){
?>
if(address.value == ""){
alert("<?php echo JText::_('OS_PLEASE_ENTER_ADDRESS')?>");
address.focus();
return false;
}else if(captcha_agent_register.value == 1){
var comment_security_code = form.comment_security_code;
var captcha_str = form.captcha_str;
if(comment_security_code.value != captcha_str.value){
alert(" <?php echo JText::_('OS_SECURITY_CODE_IS_WRONG')?>");
comment_security_code.focus();
}else{
form.submit();
}
}else{
form.submit();
}
<?php
}else{
?>
var username = form.username;
var password = form.password;
var password2 = form.password2;

if(name.value == ""){
alert("<?php echo JText::_('OS_PLEASE_ENTER_NAME')?>");
name.focus();
return false;
}else if((username.value == "") && (userid == 0)){
alert("<?php echo JText::_('OS_PLEASE_ENTER_UNAME')?>");
username.focus();
return false;
}else if((password.value == "") && (userid == 0)){
alert("<?php echo JText::_('OS_PLEASE_ENTER_PWD')?>");
password.focus();
return false;
}else if((password2.value == "") && (userid == 0)){
alert("<?php echo JText::_('OS_PLEASE_ENTER_VPWD')?>");
password2.focus();
return false;
}else if((password.value != password2.value) && (userid == 0)){
alert("<?php echo JText::_('OS_PWDANDVPWDARETHESAME')?>");
password.focus();
return false;
}else if(email.value == ""){
alert("<?php echo JText::_('OS_PLEASE_ENTER_EMAIL')?>");
email.focus();
return false;
}else if(! emailValid(email.value)){
alert("<?php echo JText::_('OS_PLEASE_ENTER_VALID_EMAIL')?>");
email.focus();
return false;
}else if(address.value == ""){
alert("<?php echo JText::_('OS_PLEASE_ENTER_ADDRESS')?>");
address.focus();
return false;
}else if(captcha_agent_register.value == 1){
var comment_security_code = form.comment_security_code;
var captcha_str = form.captcha_str;
if(comment_security_code.value != captcha_str.value){
alert(" <?php echo JText::_('OS_SECURITY_CODE_IS_WRONG')?>");
comment_security_code.focus();
}else{
form.submit();
}
}else{
form.submit();
}
<?php
}
?>
}


and change to


function submitForm(){
var form = document.ftForm;
var name = form.name;
var email = form.email;
var address = form.address;
var userid = <?php echo intval($user->id)?>;
var captcha_agent_register = form.captcha_agent_register;
<?php
if($user->id > 0){
?>
if(address.value == ""){
alert("<?php echo JText::_('OS_PLEASE_ENTER_ADDRESS')?>");
address.focus();
return false;
}else if(state.value == ""){
alert("<?php echo JText::_('Please select state')?>");
return false;
}else if(city.value == ""){
alert("<?php echo JText::_('Please select city')?>");
return false;
}else if(captcha_agent_register.value == 1){
var comment_security_code = form.comment_security_code;
var captcha_str = form.captcha_str;
if(comment_security_code.value != captcha_str.value){
alert(" <?php echo JText::_('OS_SECURITY_CODE_IS_WRONG')?>");
comment_security_code.focus();
}else{
form.submit();
}
}else{
form.submit();
}
<?php
}else{
?>
var username = form.username;
var password = form.password;
var password2 = form.password2;

if(name.value == ""){
alert("<?php echo JText::_('OS_PLEASE_ENTER_NAME')?>");
name.focus();
return false;
}else if((username.value == "") && (userid == 0)){
alert("<?php echo JText::_('OS_PLEASE_ENTER_UNAME')?>");
username.focus();
return false;
}else if((password.value == "") && (userid == 0)){
alert("<?php echo JText::_('OS_PLEASE_ENTER_PWD')?>");
password.focus();
return false;
}else if((password2.value == "") && (userid == 0)){
alert("<?php echo JText::_('OS_PLEASE_ENTER_VPWD')?>");
password2.focus();
return false;
}else if((password.value != password2.value) && (userid == 0)){
alert("<?php echo JText::_('OS_PWDANDVPWDARETHESAME')?>");
password.focus();
return false;
}else if(email.value == ""){
alert("<?php echo JText::_('OS_PLEASE_ENTER_EMAIL')?>");
email.focus();
return false;
}else if(! emailValid(email.value)){
alert("<?php echo JText::_('OS_PLEASE_ENTER_VALID_EMAIL')?>");
email.focus();
return false;
}else if(address.value == ""){
alert("<?php echo JText::_('OS_PLEASE_ENTER_ADDRESS')?>");
address.focus();
return false;
}else if(state.value == ""){
alert("<?php echo JText::_('Please select state')?>");
return false;
}else if(city.value == ""){
alert("<?php echo JText::_('Please select city')?>");
return false;
}else if(captcha_agent_register.value == 1){
var comment_security_code = form.comment_security_code;
var captcha_str = form.captcha_str;
if(comment_security_code.value != captcha_str.value){
alert(" <?php echo JText::_('OS_SECURITY_CODE_IS_WRONG')?>");
comment_security_code.focus();
}else{
form.submit();
}
}else{
form.submit();
}
<?php
}
?>
}


Thanks
Dam

Please Log in or Create an account to join the conversation.

Moderators: Dang Thuc DamNguyen Phu Quan