Pull Values from Details View and Reuse on New Form

polarweb

Jeremiah
I have a site I am working on where I have two major user groups respectively.

Job Seekers
Employers

Employers are able to post jobs, job seekers can view them. Now, here's what I want to do, I want to allow a job seeker to open up a job listing in Details view. When they get there I want them to be able to see a link or a button that redirects them to another form I will name "Job Application".

On this new form I need to collect the "job_id" employers "contact_email" and prepopulate the "Job Application" hidden fields with this data.

I need help determining the best approach to doing this, as I will need to send the employers and email notification that someone has applied for their job.
 
I'm a noob, but I think you want to pass the job_id.contact_email in a hidden field and then call it back into a new hidden field with:
$email
= $_POST['email']
 
I got somewhere today and I think it might work. I am going to use a "display" field and place a button on the details view page. When they click the button maybe I can use dynamic placeholders to build a url...
 
Going that rout myself with something similar. Though I learned my method was deprecated. But I did just find this:

Use JFactory::getApplication()->input instead.
For getting any variable (say name) from post method use below line of code
JFactory::getApplication()->input->post->get('name');
 
There is more, but I can't post links...

So to start off with: you need to call JInput via the application like so:
$jinput = JFactory::getApplication()->input;
Then, if you wish to get a single value, you can use:
$name = $jinput->get('name');
Or if you wish to get an array of data, let's say from a form with multiple fields, then you can use:
$data = $jinput->post->getArray(array());
 
Interesting. I was able to build a url with no php just used fabrik placeholders. Only problem now, is that I need to find a way to pass an email address through to the next form.

Here's what I did...

Default (Not set to Eval, just plain)
Code:
<hr />
<a href="http://mysite.com/index.php?option=com_fabrik&view=form&formid=7&mine_fabrik_applications___job_id={id}&mine_fabrik_applications___job_title={job_title}"><button class="btn btn-success">Apply Now</button></a>

When I try to add the email field into it, I get errors, its like showing it as "<span =" on the next form. Kinda odd.

Code:
<hr />
<a href="http://mysite.com/index.php?option=com_fabrik&view=form&formid=7&mine_fabrik_applications___job_id={id}&mine_fabrik_applications___job_title={job_title}&mine_fabrik_applications___contact_email={contact_email}"><button class="btn btn-success">Apply Now</button></a>

Update:

Using {$my->email} also produces the same issues.
 
Convert these to variables before you pass them in the URL think. These look like parts of a query. But I don't really know the J suff or Fabrik.
Pull up the URL with details view and post it here. Perhaps there is a cleaner way with the original URL.

mine_fabrik_applications___job_id={id}
&
mine_fabrik_applications___job_title={job_title}


 
Well, ive tried a few things with raw and I am still seeing the issues whenever i try to pass the email through. id and job title are working perfectly.

I tried a few variations:

{contact_email_raw}, {mine_fabrik_jobs___contact_email_raw}

I still get this:

Code:
<a href="http://mysite.com/index.php?option=com_fabrik&amp;view=form&amp;formid=7&amp;mine_fabrik_applications___job_id=1&amp;mine_fabrik_applications___job_title=Trimmer&amp;mine_fabrik_applications___contact_email=&lt;span id=" cloak23671"="">This email address is being protected from spambots. You need JavaScript enabled to view it.<script type="text/javascript">
//<!--
document.getElementById('cloak23671').innerHTML = '';
var prefix = '&#109;a' + 'i&#108;' + '&#116;o';
var path = 'hr' + 'ef' + '=';
var addy23671 = 'c&#111;nt&#97;ct' + '&#64;';
addy23671 = addy23671 + '&#97;kc&#97;nn&#97;b&#105;sst&#97;ff&#105;ng' + '&#46;' + 'c&#111;m';
document.getElementById('cloak23671').innerHTML += '<a ' + path + ''' + prefix + ':' + addy23671 + ''>' +addy23671+'<\/a>';
//-->
</script>"&gt;<button class="btn btn-success">Apply Now</button></a>

When it goes to the next form, this is the HTML in the element...

Code:
<input type="text" id="mine_fabrik_applications___contact_email" name="mine_fabrik_applications___contact_email" size="60" maxlength="255" class="input-xxlarge fabrikinput inputbox readonly text" readonly="readonly" value="<span id=">
 
Seems like creating a hidden field that passes the variables from detail view to Application would be enough. Then you just insert them in the form. I have been successful in a similar adventure doing this.You could do a new query at Application form but that seems pointless.

Curious, how did you get
mine_fabrik_applications___job_id=1
and
mine_fabrik_applications___job_title=Trimmer

Also, ___ might need not be the best way to drill into data. This has produced odd results for me.


 
Seems like creating a hidden field that passes the variables from detail view to Application would be enough. Then you just insert them in the form. I have been successful in a similar adventure doing this.You could do a new query at Application form but that seems pointless.

Curious, how did you get
mine_fabrik_applications___job_id=1
and
mine_fabrik_applications___job_title=Trimmer

Also, ___ might need not be the best way to drill into data. This has produced odd results for me.


Fabrik system can use placeholders in numerous areas including eval areas on most elements. It basically picks up your "placeholder tag" and then grabs the data and then outputs it.

Placeholder syntax is:

{tablename___elementname}.

Always surrounded in brackets.

Sent from my SAMSUNG-SGH-I337 using Tapatalk
 
I appreciate the info. We are running similar paths and I have seen the folly of my methods and the errors of my ways. Need to get my mind unstuck from last weeks / last extensions ways...
 
Its the URL encoding. Since an email address has an @ in it, its not going to work. It will work if lets say the email address is "myemail%40mysite.com"

I tested this out by removing the {contact_email} placeholder and just placing this for testing: myemail%40mysite.com

It successfully converted the email address and the @ showed up in the form.

Now, how would I go about changing the @ symbol to %40?

Hmm php function urlencode seems interesting...
 
V is for Victory. I got it rolling. In the eval field, set to yes, I was able to do this:

Code:
$contact_email = urlencode('{contact_email_raw}');
 
return '<a href="http://mysite.com/index.php?option=com_fabrik&view=form&formid=7&mine_fabrik_applications___job_id={id}&mine_fabrik_applications___job_title={job_title}&mine_fabrik_applications___contact_email='.$contact_email.'"><button class="btn btn-success">Apply Now</button></a>';

Here are some great places I used to learn this, Fabrik docs were imperative:

http://fabrikar.com/forums/index.php?wiki/placeholders/
http://fabrikar.com/forums/index.php?wiki/using-eval/
http://php.net/manual/en/function.urlencode.php
 
Now I can also take it a step further and add Joomla's placeholders. This makes my day.

All I gotta do is add a new variable to grab some joomla information, in this case its user's email to prepopulate next form element.

Code:
$applicant_email = urlencode('{$my->email}');

Call on the variable the same way in the URL as was done with $contact_email
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top