Prefilling a form element from a link

BasilC

Member
I'm creating a form for members of an organisation to provide some data to go into a completely new table. It would be useful if one of the fields in the new table could be the id from the main membership table - but I don't want the members to be directly updating the main table.

What I have in mind would be tacking ?pers_id='{u3a_people___id}' or something similar onto the end of a link to the new form that I'll send out using a list email plugin.

So the questions are:

1. How would I pass the id in the link?
2. Can I use a SEF url?
3. How would I populate the pers_id element in the table with the value from the url?

Just to emphasize that the members will be creating new records in the new table, not accessing existing records.
 
1) Just make your 'pers_id' be the full element name on the new table ... ?newtable___per_id={u3a_people___id}

Although you may have to append _raw to both names, to make sure you get the value, not the label.

You can test it by just appending that to the URL when loading a new form for that list.

2) Depends what you mean ... if you mean can you append that query string to a SEFed URL, then yes, usual query string rules apply ... ? separates URL from query string, & separates individual query string args, so if it's a SEF'ed URL with no query string args use ?.

If you mean can you create a SEFed URL that incorporates your variable, like /per_id/123, rather than using a query string, then no.

3) It happens automagically when you set an element name on the URL to a new form ... as long as the user has ACL access to the element. You can set the value of any element on a new form with &tablename___elementname=whatever

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top