seanc Posted July 9, 2005 Posted July 9, 2005 Hi All, Thought this would be easy, but I can't work out the elegant way to acheive it. I have a drop down list which contains all my field names. Using this, my users can select the field they want results to sort by when submitting a form. Easy. My problem is that the field names don't translate to human readable format. eg. I have a field called "serialNumber", but I want the list to show "Serial Number". Or worse, field is "sites::siteCode", list should display "Site Code". I could use if statements, but I'm sure there must be a more efficient way. Appreciate any help! Cheers...Sean.
Garry Claridge Posted July 10, 2005 Posted July 10, 2005 Are you automating the population of the Selection tag? Or, are you writing the names into the page? All the best. Garry
seanc Posted July 10, 2005 Author Posted July 10, 2005 Hi Garry, Automating sounds like a good idea, but I'm still trying to figure all this stuff out so first step I was just going to type them into the page. I imagine it will be even trickier when I try to automate... Thanks, Sean.
Garry Claridge Posted July 10, 2005 Posted July 10, 2005 You can just add them like this: <select name="fields"> <option value="serialNumber">Serial Number</option> <option value="sites::siteCode">Site Code</option> ..... </select> You could then read them with: $selection_field = $_POST['fields']; Hope this helps. All the best. Garry
seanc Posted July 10, 2005 Author Posted July 10, 2005 Hi Garry, So, simple. I should have been able to work that out. Thank you!! So, in order to save me much stumbling about, can you point me in the right direction for automating this? Thanks again, Sean.
Garry Claridge Posted July 10, 2005 Posted July 10, 2005 I think you should be able to get a list of field names with: [FMP-LayoutFields] [FMP-FieldName] [/FMP-LayoutFields] An example from the CDML Reference database: <select name="fields"> <option value="">-None- [FMP-LayoutFields] <option>[FMP-FieldName: Raw] [/FMP-LayoutFields] </select> All the best. Garry
Recommended Posts
This topic is 7145 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now