Skip to content

Instantly share code, notes, and snippets.

@keithmancuso
Created May 18, 2014 20:22
Show Gist options
  • Save keithmancuso/7bf120e36fdc7c482669 to your computer and use it in GitHub Desktop.
Save keithmancuso/7bf120e36fdc7c482669 to your computer and use it in GitHub Desktop.
Add a job form
<form method="post" action="" accept-charset="UTF-8">
<input type="hidden" name="action" value="entries/saveEntry">
<input type="hidden" name="redirect" value="account/jobs?added={id}">
<input type="hidden" name="sectionId" value="9">
<input type="hidden" name="enabled" value="0">
<div class="form-group">
<label for="title">Job Title</label>
<input id="title" type="text" class="form-control" name="title">
</div>
<div class="form-group">
<label for="organizationName">Oraganization Name</label>
<input id="organizationName" type="text" class="form-control" name="fields[organizationName]" value="{{currentUser.organizationName}}">
</div>
<div class="form-group">
<label for="organizationName">Address</label>
<input id="organizationName" type="text" class="form-control" name="fields[fullAddress][street1]" placeholder="Street Address" >
<input id="organizationName" type="text" class="form-control" name="fields[fullAddress][street2]" placeholder="Apartment or Suite" >
<input id="organizationName" type="text" class="form-control" name="fields[fullAddress][city]" placeholder="City" >
<input id="organizationName" type="text" class="form-control" name="fields[fullAddress][state]" placeholder="State" >
<input id="organizationName" type="text" class="form-control" name="fields[fullAddress][zip]" placeholder="Zip" >
<input id="organizationName" type="hidden" name="fields[fullAddress][country]" value="United States">
<input id="organizationName" type="hidden" name="fields[fullAddress][lat]" value="">
<input id="organizationName" type="hidden" name="fields[fullAddress][lng]" value="">
</div>
<div class="form-group">
<label for="jobDescription">Job Description</label>
<textarea id="jobDescription" class="form-control rich-text" name="fields[jobDescription]">
</textarea>
</div>
<div class="form-group">
<label for="jobDescription">Qualifications</label>
<textarea id="jobDescription" class="form-control rich-text" name="fields[qualifications]">
</textarea>
</div>
<div class="form-group">
<label for="applicationInstructions">Application Instructions</label>
<textarea id="applicationInstructions" class="form-control rich-text" name="fields[applicationInstructions]">
</textarea>
</div>
<div class="form-group">
<label for="applicationUrl">Application URL</label>
<input id="applicationUrl" type="text" class="form-control" name="fields[applicationUrl]">
</div>
<div class="form-group">
<label for="applicationDeadline">Expiration Date</label>
<input id="applicationDeadline" type="text" class="form-control" name="expiryDate[date]">
</div>
<input type="submit" value="Publish" class="btn btn-primary">
</form>
@lindseydiloreto
Copy link

Awesome, thanks Keith! I'll try to sort something out that works with your existing code.

Things I'm trying to keep in mind:

  • Partial addresses can have more than one lat/long match. The user may need to select which match is correct.
  • It's possible that a lat/long would need to be left blank intentionally.

For both of those reasons, I probably wouldn't have it automatically figure the lat/long on element save. That data should get sorted out on the front-end first, and stored in the hidden input fields before saving.

I'll take a look at this over the next few days, and I'll let you know how it goes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment