Jump to content
  • 0

Additional Fields Validation For Blesta


techstar123

Question

Hi,

I have added validations for additional fields for domain using validateservice method.

But once validation fires it does not show those additional fields insted it shows only nameservers fields. How can I resolve it?

 

Once those validation fires and user press conitnue button it is moved to next view without having domain name.

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0

You'll need to provide more details on what you're trying to do. It sounds like you're working with a domain module, but you may not have setup your validation rules correctly.

 

My validations are getting fired for domain fields. But it does not keep open same page where error occurred. Instead of it allow me to register next domain.

 

Steps:

1. I checked my domain is available or not.

2. if my domain is available, I tried to give additional fields(with incorrect values, so validations can get fired) and nameservers details.

3. Since I have entered invalid details it shows me message "Invalid details provided"(my validation message).

 

But then it does not keep open the same page where I have entered invalid details. Instead it opens new page where I can register new domain. So, I have to manually press back button of browser and then I can enter valid details.

Link to comment
Share on other sites

  • 0

at least paste your code of validation and the fields you need to validate .

 

public function validateService($package, array $vars=null) {

   $rules = array(

       'organization' => array(

                'empty' => array(

                    'if_set' => true,

                    'rule' => 'isEmpty',

                    'negate' => true,

                    'message' => "Organization name is required"

                )

            )

  );

}

Link to comment
Share on other sites

  • 0

i think this rule is enough

'organization' => array(

'format' => array(

'rule' => "isEmpty",

'negate' => true,

'message' => "Organization name is required" )

)

but your probleme i think is not the validator , is how/where the validateservice should act .

normally if the validation return error , it should not go to next stop , is sending a error set and then the page should not go to other page .

Link to comment
Share on other sites

  • 0

i think this rule is enough

'organization' => array(

'format' => array(

'rule' => "isEmpty",

'negate' => true,

'message' => "Organization name is required" )

)

but your probleme i think is not the validator , is how/where the validateservice should act .

normally if the validation return error , it should not go to next stop , is sending a error set and then the page should not go to other page .

Yes, my problem is page is going to other page. Actually it should not redirect if there is error.

Link to comment
Share on other sites

  • 0

public function validateService($package, array $vars=null) {

   $rules = array(

       'organization' => array(

                'empty' => array(

                    'if_set' => true,

                    'rule' => 'isEmpty',

                    'negate' => true,

                    'message' => "Organization name is required"

                )

            )

  );

}

 

Is this the entirety of your validation? If so, that is not sufficient, and the reason you're able to continue on to the next page is because no validation occurs.

 

You have defined a rule in $rules, but never use it for Input validation, e.g.

public function validateService($package, $vars=null) {
    $rules = array(
        ...
    );

    $this->Input->setRules($rules);
    return $this->Input->validates($vars);
}
Link to comment
Share on other sites

  • 0

Is this the entirety of your validation? If so, that is not sufficient, and the reason you're able to continue on to the next page is because no validation occurs.

 

You have defined a rule in $rules, but never use it for Input validation, e.g.

public function validateService($package, $vars=null) {
    $rules = array(
        ...
    );

    $this->Input->setRules($rules);
    return $this->Input->validates($vars);
}

i have touch that his validateservice is a set for rules to use in in somewhere .

you have touch a good point .

Link to comment
Share on other sites

  • 0

 

Is this the entirety of your validation? If so, that is not sufficient, and the reason you're able to continue on to the next page is because no validation occurs.

 

You have defined a rule in $rules, but never use it for Input validation, e.g.

public function validateService($package, $vars=null) {
    $rules = array(
        ...
    );

    $this->Input->setRules($rules);
    return $this->Input->validates($vars);
}

 

I have added last 2 lines. But I forgot to add it here.

Validations are occcuring. It is showing me my error message.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...