TK Tek, LLC
300 B St.
Sergeant Bluff, IA 51054
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: Managing required fields

Managing required fields 3 years 10 months ago #2661

  • Eduardo
  • Eduardo's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
  • Karma: 0
Hello guys,
Does anyone have the experience on making some fields in the application form mandatory?.

I'm going nuts trying to make the "Application dropdown list" required. I need to make the following field required:



Is there a way to do this?. Is there a way to mark any field as required?.

Any suggestion is appreciated :)

Eduardo.
The administrator has disabled public write access.

Managing required fields 3 years 10 months ago #2666

  • Bob
  • Bob's Avatar
  • OFFLINE
  • Administrator
  • Posts: 1101
  • Thank you received: 128
  • Karma: 30
Hi Eduardo,

Through the menu item parameters for the application form there are a few parameters to require some fields. Unfortunately, the one you're looking for doesn't exist as a parameter.

I can guide you a little, but my Spanish (tell me it's spanish, if not I apologize) is non-existance, so I'm not 100% sure which field that is.

But, the file you'll want to look in to check for the fields validity is yourjoomlaroot/administrator/components/com_jobgrok/tables/application.php.

Within that file you'll see other validity checks (function check())

Let's start with that and I'll assist further specifically in the form of:

if (!$this->first_name) { etc... }

Note the "flag_fields" and "_notices" - these will be relevant to help display any messages to the user and highlight the required field. (doing this from memory right now so let me know if you need further guidance and I'll take a closer look).

Sincerely,
Bob.
If you have the time and like JobGrok, please take the time to post a review on the Joomla! Extension Directory. JobGrok's survival depends on reviews! Thanks.
The administrator has disabled public write access.

Managing required fields 3 years 10 months ago #2674

  • Eduardo
  • Eduardo's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
  • Karma: 0
Hi Bob,
Thanks for your quick reply. And yes, that's Spanish :)

The field I'm referring to is the one in which the user can select the desired job to apply.
It's being a requirement that the applicant chose and existent job while preventing a "generic" job application.

I've already found the file and the function... Could you please assist me in adding the validation there?.

Thanks!.
The administrator has disabled public write access.

Managing required fields 3 years 10 months ago #2690

  • Bob
  • Bob's Avatar
  • OFFLINE
  • Administrator
  • Posts: 1101
  • Thank you received: 128
  • Karma: 30
Hi Eduardo,

To validate if a job posting was selected, I think the following will work.

In the following file:

/yourjoomlaroot/administrator/components/com_jobgrok/tables/application.php

Look for the following line:
if ($posting_id > 0) {

This line is validating the selected posting id and there is no validation if the posting_id is "0" - or not selected, so the submission goes through as a valid submission.

To force the issue, locate the closing bracket for that if statement and replace it with the following:
} elseif ($posting_id == 0) {
    $this->_notices[] = JTEXT::('A posted job must be selected'); // or something similar
    $result = false;
}

Note: I have not tested this, but will be adding something similar to the code.

I think this will do what you're asking.

Sincerely,
Bob.
If you have the time and like JobGrok, please take the time to post a review on the Joomla! Extension Directory. JobGrok's survival depends on reviews! Thanks.
The administrator has disabled public write access.
The following user(s) said Thank You: Eduardo

Managing required fields 3 years 10 months ago #2695

  • Eduardo
  • Eduardo's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
  • Karma: 0
Hey Bob,
Thanks, the validation worked like a charm!!!. You only missed an underscore at the message, so my -final- code looks like:
} elseif ($posting_id == 0) {
    $this->_notices[] = JTEXT::_('A posted job must be selected'); // or something similar
    $result = false;
}

Thanks again!.

PS: now I'm facing an issue when I try to enter www.mysite.com/administrator/index.php?o...ntroller=application
I'm not being able to see any of the applications (just a white screen). But reverting the changes doesn't solve the issue... Wondering what can be. Let me know if I should open a separate thread or if there is some reference to that.
The administrator has disabled public write access.

Managing required fields 3 years 10 months ago #2696

  • Eduardo
  • Eduardo's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
  • Karma: 0
Bob, please forget my PS, I've found the issue, my mistake :)
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Moderators: Bob
Time to create page: 0.132 seconds