I have to use profile module, for my website, but I don't know how to enable, autofill feature there.
Plase find attached screenshot.

This is "must have" feature for my website. Thank you for your help.

PS. I've created 600 schools (school content type) so far.

CommentFileSizeAuthor
autofill.jpg86.99 KBadpo
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rfay’s picture

Component: ajax system » profile.module
adpo’s picture

I was able to add readonly atributes through form_api, then I will create link "Update link" after school number using theme template. The last step is to AJAXify this form, with content from existing nodes (schools).

rfay’s picture

Remember that other people will find this issue in the future, so please make sure to report back with your successful techniques.

adpo’s picture

I have simple question here:
How can add PHP if statement (form id = user_register) for my function:

...
function glue_init() {
	drupal_add_css(drupal_get_path('module', 'glue') .'/glue.css');
	drupal_add_js(drupal_get_path('module', 'glue') .'/glue.js');
}
adpo’s picture

Solution.
Create new module, with js file:
1. Add update link
2. Create URL variable (quite easy when automatic title generation is enabled using id as a token)
3. Request data from URL (page content)
4. Pass your data to your fields.

PS> I don't know how to add js only for registration form in my module.

$(document).ready(function() {
$('<a href="#" class="glue">Update Details</a>').appendTo('#edit-profile-id-wrapper');
$('a.glue').click(function() {
	var profile_id = $('[name=profile_id]').val();
	var alias = '/id/';
	var url = alias + profile_id;
	$.ajax({
		url: url,
		success: function(data) {
	    var $idName = $('.field-field-id-name .field-item', data);
		var sn = $idName.text();	
	    var $address1 = $('.field-field-id-address1 .field-item', data);
		var a1 = $address1.text();
	    var $address2 = $('.field-field-id-address2 .field-item', data);
		var a2 = $address2.text();
	    var $address3 = $('.field-field-id-address3 .field-item', data);
		var a3 = $address3.text();
		var $address4 = $('.field-field-id-address4 .field-item', data);
		var a4 = $address4.text();
	    $('#edit-profile-idname').val(sn);
		$('#edit-profile-bill1').val(a1);
		$('#edit-profile-bill2').val(a2);
		$('#edit-profile-bill3').val(a3);
		$('#edit-profile-bill4').val(a4);
		}
	});
	return false;
});
});
gloomcheng’s picture

PS> I don't know how to add js only for registration form in my module.

Use hook_form_alter function?

Status: Active » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.