*

Don Domainer

  • ***
  • 26 posts
Validate preselected location
« on: March 18, 2017, 05:24:01 AM »
 How validated pre-selected location ( city )

In deep.

I use subdomain base city, so, when arrive at the submission form x city, the city x is already displayed in the form. check the image plz





But, although it is already shown the city is not validated, so the million dollar question, how validated the city?



Code: [Select]
<input type="text" name="term" id="term" class="term" placeholder="<?php _e('Country, Region or City''veronika'); ?>" value="<?php echo veronika_get_term(Params::getParam('term'), Params::getParam('sCountry'), Params::getParam('sRegion'), Params::getParam('sCity')); ?>" autocomplete="on"/>

« Last Edit: March 18, 2017, 05:30:48 AM by Don Domainer »

*

MB Themes

Re: Validate preselected location
« Reply #1 on: March 18, 2017, 06:46:42 AM »
@Don
I do not fully understand to your question. City (location) is validated in time you click on next button.
If you would like to have it validated on page load, then you would call something like $('.term').valid(); in javascript.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Don Domainer

  • ***
  • 26 posts
Re: Validate preselected location
« Reply #2 on: March 18, 2017, 12:29:54 PM »
@Don
I do not fully understand to your question. City (location) is validated in time you click on next button.
If you would like to have it validated on page load, then you would call something like $('.term').valid(); in javascript.

That is the best news of the week...plz, can you you explain how to do this?

*

MB Themes

Re: Validate preselected location
« Reply #3 on: March 18, 2017, 08:04:21 PM »
@Don
I already did:
If you would like to have it validated on page load, then you would call something like $('.term').valid(); in javascript.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Don Domainer

  • ***
  • 26 posts
Re: Validate preselected location
« Reply #4 on: March 18, 2017, 09:02:40 PM »
@Don
I already did:
If you would like to have it validated on page load, then you would call something like $('.term').valid(); in javascript.

Sorry, But I do not understand, I have to add that to any existing java document ?

*

MB Themes

Re: Validate preselected location
« Reply #5 on: March 19, 2017, 11:12:08 AM »
@Don
You need to create your own javascript function that will validate this field on page load.
I gave you code that needs to be called (with correct selector), rest is on you.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Don Domainer

  • ***
  • 26 posts
Re: Validate preselected location
« Reply #6 on: March 19, 2017, 03:33:06 PM »
@Don
You need to create your own javascript function that will validate this field on page load.
I gave you code that needs to be called (with correct selector), rest is on you.

I can pay for this, yo just need to give me the code and the instructions, no hurry, If you can do it, I can go on with something else, and the next week we do it.

Understand my careful not to put anyone else to touch this, you are the creator and knows better than anyone how their creation works.

*

MB Themes

Re: Validate preselected location
« Reply #7 on: March 19, 2017, 04:15:57 PM »
@Don
If you place following code to item-post.php at the end right before </body> tag, it will run validation of location field when page is loaded:
Code: [Select]
<script>
  $(document).ready(function(){
    $('.term').valid();
  });
</script>
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Don Domainer

  • ***
  • 26 posts
Re: Validate preselected location
« Reply #8 on: March 19, 2017, 04:46:34 PM »
@Don
If you place following code to item-post.php at the end right before </body> tag, it will run validation of location field when page is loaded:
Code: [Select]
<script>
  $(document).ready(function(){
    $('.term').valid();
  });
</script>

Wooo.. I really appreciate your help, I have added the code, at the end right before </body> tag, but it does not work

*

MB Themes

Re: Validate preselected location
« Reply #9 on: March 19, 2017, 05:47:19 PM »
@Don
What is your URL?
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Don Domainer

  • ***
  • 26 posts
Re: Validate preselected location
« Reply #10 on: March 19, 2017, 05:55:41 PM »
@Don
What is your URL?

NO 9

X 9 F 9 i 9 N 9 i   

COM

*

Don Domainer

  • ***
  • 26 posts
Re: Validate preselected location
« Reply #11 on: March 21, 2017, 06:02:30 AM »
I researched a little more about why validator not work, and i found this error :

Uncaught TypeError: Cannot read property 'settings' of undefined
    at Function.staticRules (jquery.validate.min.js:39)
    at init.rules (jquery.validate.min.js:16)
    at c.validator.check (jquery.validate.min.js:28)
    at c.validator.element (jquery.validate.min.js:24)
    at HTMLInputElement.<anonymous> (jquery.validate.min.js:15)
    at Function.each (jquery.min.js:2)
    at init.each (jquery.min.js:2)
    at init.valid (jquery.validate.min.js:15)
    at HTMLDocument.<anonymous> (index.php:1592)
    at k (jquery.min.js:2)


This error only appears with

Code: [Select]
<script>
  $(document).ready(function(){
    $('.term').valid();
  });
</script>

*

MB Themes

Re: Validate preselected location
« Reply #12 on: March 21, 2017, 08:03:54 AM »
@Don
I have not got such error on demo, when placed on bottom of page.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Don Domainer

  • ***
  • 26 posts
Re: Validate preselected location
« Reply #13 on: March 21, 2017, 08:10:38 AM »
@Don
I have not got such error on demo, when placed on bottom of page.

The reason is this

Code: [Select]
<script>
  $(document).ready(function(){
    $('.term').valid();
  });
</script>

Apparently is a conflict with form, because it already exists "validate"

*

Don Domainer

  • ***
  • 26 posts
Re: Validate preselected location
« Reply #14 on: March 21, 2017, 08:24:40 AM »
@Don
What is your URL?

I found the solution... that was great. Thanks