How to make dynamic form fields update?

This is going to be an ugly post, fair warning! :)
I have a form that gets it's labels and text input field
names dynamically from a database. Rather than having the form
hardcoded, we are able to add new columns to a table and the form
automatically adds new labels and fields via CFQUERY.
When the form is completed and they submit (method post), the
database is supposed to update. However, because our input field
names are being populated via query, we can't write a static update
query when we add new form items.
So, I do have a solution to this (in my head), but I'm stuck
at a bit of logic and am having trouble getting it out in code. I'm
looking for a way to write #FORM.#fieldname## (here is where it
gets ugly). Since the form submits by post method, I am left with a
bunch of FORM.fieldname's on my action page (and fieldname is
generic for what the actual variables are).
So here's how I am updating:
I have a table (call it table1) that contains a column of all
the column names of my data table (table2). This table is used for
query purposes only, no data is updated here from the form.
I query table1 to call all the names of the columns in
table2.
<cquery datasource="exdb" name="exname">
SELECT columnName
FROM table1
</cfquery>
Then I write the update query which will update items as they
are looped using CFOUTPUT:
<CFOUTPUT QUERY="exname">
<cfquery datasource="exdb" name="exupdate">
UPDATE table2
SET #columnName# = #FORM.<columnName>#
WHERE itemID = #FORM.itemID#
This is my dilemma. As you can see, the cfoutput is a loop..
so let's take the first item in the loop, call it "name1". So our
update query says SET name1 = #FORM.name1#, and this will update
the table with whatever was submitted in name1's input field. The
cfoutput loops again, this time it's name2. SET name2 =
#FORM.name2#. Now the form does include a hidden input of itemID to
specify where the table should be updating, as you can see above.
So, now that you see how this works, my problem is getting
#FORM.<columnName># to be FORM.name1, FORM.name2, etc.
In Coldfusion you would write #FORM.variable# to call a FORM
item. However, since the variable is pretty much undefined and we
use a query to populate it, we need to do #FORM.#variable## where
#variable# needs to be resolved before #FORM._______#
Are you with me on this? It's very complex in explanation,
but if you need more info, I can provide it more clearly. Let me
know what you guys think. Really, I have the solution, but getting
#FORM.#columnName## to resolve is another problem. I think what i
need is to figure out the order of operation for that statement, so
#columnName# resolves first.

You'll want to use the scope structure notation when dealing
with your form variables. The variable Form.SomeVar can also be
written as Form["SomeVar"]. Using this syntax, you can do something
like this:
UPDATE table2
SET #columnName# = #FORM[columnName]#
WHERE itemID = #FORM.itemID#
You may also want to look into the following to help optimize
your code:
1) check out how to use <cfqueryparam> - it might speed
your code up a bit.
2) depending on the DB you are using, you may be able to
combine all of your UPDATE SQL commands inside 1 <cfquery>
</cfquery> block. This will allow you to do all your database
actions with 1 DB connection, instead of a bunch (works in MSSQL,
not sure about Oracle or MySQL)

Similar Messages

  • How to make Resource Forms fields non editable (OIM)

    Hi all!
    I would like to know if there's any way to make some resource fileds non editable.
    I have one resource which is getting 3 fileds from the oim user profile. When i change the oim user profile, these values are updated on the resource form associated.
    But i want to prevent the situation in which those fields are directly updated on the resouce form.
    I now i can propagate those changes back to oim profile but it will be much appropiate for what we want if we just could prevent anyone from changing those values on the resource form.
    Is it possible to make those fields non editable? How?
    OIM version is 9.1.0.1.
    Thanks in advance.

    Hi, thanks.
    Finally i found this: http://kr.forums.oracle.com/forums/thread.jspa?threadID=591683
    and after setting the fields to required=false, it worked without any errors ("The Resource has not been configured properly" because of the prepopulate adapters)
    Bye

  • How to make read only field in Task list?

    Hi All,
    How to make read only field in Task list?

    This can be done one of two ways:
    1. Customize the form in Infopath, right click your field and disable the control.
    2. Use JavaScript/jQuery on the page to disable the element.
    Andy Wessendorf SharePoint Developer II | Rackspace [email protected]

  • Vendor Master Management - How to make 'Corporate Group' field an autoupdat

    Vendor Master Management - How to make 'Corporate Group' field an automatically updated field
    Frnz,
    I am doing a Spend Analysis and thereby restructring some aspects of SAP and business processes. One of the intiatives is to leverage the 'Corporate Group' field in Vendor Master for getting the consolidated spend visibility at the corporate group level of vendors. So far this field wasn't been used to effect. I can update it manually, but the question remains is how do I do with the change management of the corporate group of large vendor base in the scenario of everhappening Mergers and Acquisitions. Are there any alternatives anybody can suggest ? (Like linking D&B numbers etc)
    Thanks in advance for your suggestions..

    Hi Shiv,
    Let me elaborate the purpose of using this field. I want to have a consolidated spend visibility across a corporate group which has multiple vendor codes. Its difficult everytime to group the spends of these vendors manually especially when the number of vendors are too high. Also sometimes the names of vendor companies may not indicate that these are from same corporate group but in fact they could be. In order to have the reports generated on corporate groups, I must maintain this field in vendor master or a Z table. But the problem here is, it should be possible to update this field as and when there are any mergers or acquisitions at vendor side and the corporate group of a particular vendor gets changed due to this. So this has to be effected in vendor master or Z-table automatically. I do know that there are certain agencies like Dunn & Brad (DNB) which provide possibly the details on corporate group of a company but its not fully effective for Indian Vendors as its not mandatory on them to have DNB number & also its a disconnected process and I was looking to connect it seamlessly to Corporate Group field so that I need not bother to update these things manually everytime. I also wanted to explore various possibilities of doing this.
    I hope I have spelled it out correctly.

  • How to make a form using a wizard when the table has no primary key ?

    Hi,
    I want to make a form to update, delete a table. The table has no primary key. The problem is that the Wizard ask for a primary key.
    How to avoid using a primary key ? i mean I don't want to create a primary key if is is possible.
    I would like to use the wizard; is it possible ?
    Thank you for your kind answers.
    Christian

    I believe the key is choosing 'Interactive' as opposed to 'Classic' in the implementation and then you can choose 'Existing Trigger' for the primary key source and it should work to use an existing column as your proimary key.

  • How to make dynamic search items in a report?

    Hi all,
    I have two questions.
    1. How to make dynamic search (i.e without GO button) field above report to provide dynamic search by words in one field of report query?
    2. How to make similar multiply dynamic search fields on report to provide individual search by selected fields of report with refine capability (i.e any search conditions in different fields must work together as complex WHERE clause)
    Thanks in advance

    hey yuri--
    if i'm understanding your questions correctly, the easiest way to achieve the functionality you're after is to have your query criteria fields submit the page when values are entered/selected. the page should then branch back to itself using the submitted criteria in the query. because you're asking about dynamically adding in your where clause predicates, you should consider using a report region of type "SQL Query (Pl/sql Function Body Returning SQL Query)". that way you can use pl/sql to piece together your query based on the provided criteria.
    so the part of your question i'm not sure of is when your page should submit itself ("without a GO button" as you said). for your first question, it seems to be a simple matter of javascript. you want users to be able to enter search criteria into a field and have that criteria be using in the report. to facilitate that we have a few self-submitting item types such as "SelectList with Submit" and "Text Field (always submits page when Enter pressed)". for your second question, it seems that you should have a Go button for the user to indicate he's done entering in his query criteria. anyhow, that's up to you, i suppose. hopefully this response will give you the concepts you need to implement this as you'd like.
    regards,
    raj
    ps-after re-reading your post, i now realize there's a chance that you wanted users to not have to submit the page at all when filtering their result sets. if that's the case, you'd have to use javascript for that cumbersome feat. google would be a good place to go for that code.

  • How to make Dynamically Shortened Text With "Show More"

    Hi there! i want to know how to make dynamically shortened text with show more or read more in my website using HTML 5 pages  or ASP.NET ?
    example like these paragraphs 
    Lorem Ipsum är en utfyllnadstext från tryck- och förlagsindustrin. Lorem ipsum har varit standard ända sedan 1500-talet, när en okänd boksättare tog att antal bokstäver och blandade dem för att göra ett provexemplar av en bok. Lorem ipsum har inte bara överlevt fem århundraden, utan även övergången till elektronisk typografi utan större förändringar. Det blev allmänt känt på 1960-talet i samband med lanseringen av Letraset-ark med avsnitt av Lorem Ipsum, och senare med mjukvaror som Aldus PageMaker.
    Det är ett välkänt faktum att läsare distraheras av läsbar text på en sida när man skall studera layouten. Poängen med Lorem Ipsum är att det ger ett normalt ordflöde, till skillnad från "Text här, Text här", och ger intryck av att vara läsbar text. Många publiseringprogram och webbutvecklare använder Lorem Ipsum som test-text, och en sökning efter "Lorem Ipsum" avslöjar många webbsidor under uteckling. Olika versioner har dykt upp under åren, ibland av olyckshändelse, ibland med flit (mer eller mindre humoristiska).
    I motsättning till vad många tror, är inte Lorem Ipsum slumvisa ord. Det har sina rötter i ett stycke klassiskt litteratur på latin från 45 år före år 0, och är alltså över 2000 år gammalt. Richard McClintock, en professor i latin på Hampden-Sydney College i Virginia, översatte ett av de mer ovanliga orden, consectetur, från ett stycke Lorem Ipsum och fann dess ursprung genom att studera användningen av dessa ord i klassisk litteratur. Lorem Ipsum kommer från styckena 1.10.32 och 1.10.33 av "de Finibus Bonorum et Malorum" (Ytterligheterna av ont och gott) av Cicero, skriven 45 före år 0. Boken är en avhandling i teorier om etik, och var väldigt populär under renäsanssen. Den inledande meningen i Lorem Ipsum, "Lorem Ipsum dolor sit amet...", kommer från stycke 1.10.32.
    Den ursprungliga Lorem Ipsum-texten från 1500-talet är återgiven nedan för de intresserade. Styckena 1.10.32 och 1.10.33 från "de Finibus Bonorum et Malorum" av Cicero hittar du också i deras originala form, åtföljda av de engelska översättningarna av H. Rackham från 1914.

    Moved to the main Dreamweaver support forum.
    There are several ways you could approach this. Here's one you might try:
    Give the first paragraph an ID, such as "first", and wrap the paragraphs you want to hide in a <div> with another ID, such as "more". Then add the following block of JavaScript just before the closing </body> tag of the page:
    <script>
    var first = document.getElementById('first'),
         more = document.getElementById('more'),
         trigger = document.createElement('span');
    trigger.id = 'trigger';
    trigger.innerHTML = 'Show less';
    first.appendChild(trigger);
    function toggleDiv() {
      var state = more.className,
           text = trigger.innerHTML;
      more.className = (state == 'open') ? 'closed' : 'open';
      trigger.innerHTML = (text == 'Show more') ? 'Show less' : 'Show more';
    toggleDiv();
    if (trigger.addEventListener) {
        trigger.addEventListener('click', toggleDiv, false);
    } else if (trigger.attachEvent) {
      trigger.attachEvent('onclick', toggleDiv);
    } else {
      trigger.onclick = toggleDiv;
    </script>
    This gets references to the "first" paragraph and the "more" <div>. It also creates a <span> with the ID "trigger" that's appended to the "first" paragraph. The rest of the script defines a function called toggleDiv(), which toggles the "more" <div> open and closed, and changes the text in the "trigger" <span>.
    You also need to create the following style rules for the various elements:
    <style>
    #trigger {
        text-decoration: underline;
        color: blue;
        cursor: pointer;
    #more {
        transition: ease-out .7s;
        overflow: hidden;
    #more p:first-child {
        margin-top: 0;
    #more.closed {
        height: 0;
        -webkit-transform: translateY(-600px);
        transform: translateY(-600px);
    #more.open {
        -webkit-transform: translateY(0);
        transform: translateY(0);
        max-height: 600px;
    #more + p {
        margin-top: 0;
    </style>
    This solution hides the text and creates the "trigger" <span> only if JavaScript is enabled in the browser. It should work in all browsers, including Internet Explorer 8 and earlier.

  • Interactive PDF form on Android, can I make a form field to open camera and use photo in field?

    If I have an interactive PDF form on Android, is there any way to make a form field that will open the camera and insert the photo in the field?

    One alternative would be to create a web form in FormsCentral and use the attachment feature.

  • How to make Sales Office field mandatory in VA01 initial screen?

    Hi,
    How to make Sales Office field mandatory in VA01 initial screen? I mean in the first screen where we enter the document type and the sales area?
    Regards,
    Ajit

    Dear Deepak,
    Thanks for the clarification.
    But, as far, I have understood the query - it is very simple and that is..
    Whenever one creates a Sales Order (T.Code: VA01), Parameter: Sales Office needs to be mandatory (for all Sales Order, irrespective of Customer Account).
    Until-unless, user won't enter the parameter: Sales Office, System will not lead to next page (now, here we need to enter Customer/ material etc...).
    I have answered the query, in this regards, only.
    Best Regards,
    Amit.
    Note: Pls. correct me, if I am wrong. Thanks for everyones guidance.

  • How to make tax classification field mandatory in sales order ?

    Hi,
    while creating sales order, " how to make tax classification field mandatory ".
    Please tell me the procedure.
    In tcode OVA2. what are the entries for fields,table.
    Regards,
    sapsduser

    Dear ,
    Could you please share why you want to make tax Classification field mandatory in sales order.
    Maintain Tax classification field for customer in Customer Master Data = (Sales Area Data - Billing document Tab page)
    Tax Classification field for Material in Material Master Data = Sales Org. 1 View.
    While creating sales order and enter customer and material system automatically fetch the tax classification related data into sales order.
    Tax is calculated based on the ship to party.
    Hope this will help you.....
    Regards,
    Manoranjan.

  • How to make valuation type field not changeable  in delivery tab of PO

    Hai friends,
                    I am new to badis..please guide me to solve the issue...
    how to make valuation type field not changeable  in delivery tab of PO...
    The field shd be in display mode only ...actually...there  a badi has been used before
    to get valuation type from a ztable depending on material and plant...
    Now ..my requirement is that the user shd not change the default value brought from the ztable...

    Hi SRINIVAS,
    You can achieve this from BADI only if BADI is allows you to do this. You cannot achieve everything from a BADI. Check if there is any expoting field in the methods that can be ticked for making the field in display mode. If not then you cannot achieve this from BADI.
    The field you want to default to display is a standard or zfield. If z, then you can changethe attribute of the screen field to Output only.
    Regards,
    Manish

  • Quick Tip: How to create editable form fields | Acrobat X Tips & Tricks | Adobe TV

    A short tip that details how to create editable form fields using Acrobat X Std. or Pro.
    http://adobe.ly/wzXkmL

    I have created a form which will be filled out by customers and sent back to me via 'submit' button. What I am trying to figure out is when we receive the filled out form, is there any way to have it as a pdf. To clarify, when the form is filled out and sent, the receiver opens the email and attached is a non-editable pdf. This way the customers information is no longer editable.

  • How to make a form for input in web interface builder

    Hi expert:
        How to make a form for input in web interface builder?I have already used it to do PS planning, but I don't know how to  draw lines and checkboxes . Thanks in advance.
    Allen

    WAD:
    Open the WAD and create a new template. On the left hand navigation you will have several Web Items available. Under 'Standard' you have 'Analysis' item. Pull that into your template to the right. Under the Properties tab you need to pick the query [form/layout] that you have built in Query Designer.
    You will also find other items such as Button group, Checkbox, drop down, list box etc available. Pick and drag into the template whatever it is you require. Lets say you want a button. Under the Properties tab select the 'Command' that you require. You could use standard commands that are available there. You could also define functions and commands that you require.
    Query Designer:
    Open the QD and drag the characteristics and key figures that you require into the rows and columns of the QD. You would need to specify restrictions under the Filter tab of the QD based on the granularity of data that you require. You would need to remember that the key figures need to be made Input Ready [do this by clicking on KF and on the planning tab select "change by user and planning functions"].
    This shouldgive you a start. After you've explored it yourself a bit we can discuss further and I can certainly provide you additional details/material on these areas.
    Srikant

  • How to make Firefox to never update that slow custom look since FF 29?

    How to make Firefox to never update that slow custom look since FF 29? How to change windows installation and ubuntu installation so they never update after FF 28 witch was last normal speed normal browser?
    Hello. I can easy remove on Windows FF 29 or FF 30 and its slower on fast computer. But its affected by millions of users. With FF 28 it was allways fast.
    Why fast? I dont know but its SLOW Now any version after FF 28.
    Since FF 29 FF loads and hangs very very slow each time loading, starting, or changing tabs. It is making problem for everyone and now everyone calls with help- "why computer is slow.. oh its FF? Chrome? Chrome was slow but now its not the slowest one?"
    Very colorfull Example- one comp is 10" and its very very very very low specs. So it wont run at all.
    Now on small comp we can try linux and FF BUT no matter what OS just couldnt get back with any plugins back normal speed. Since FF 29 its very very very slow and that needs to have a solution. Today came update and still unneded custom menu button and its slowness hasnt been removed (unnoticed) so it needs a fix so it works for people who are not just for browsing internet buying new computer and cant get any faster speed then Chrome since now theres no FF anymore.
    SO- How to do that on Windows and Linux- installing FF 28 and making it never upgrade
    OR even better- Making a package that already has this update disbled setting ON?
    p.s. Should you first ask people how they like slow browsers before making fast one to a slow one?
    p.p.s. i dont get how menu could be added by thouse who need it as an add-on ass allways and not presuring everyone who never touches any button.
    p.p.p.s. your business was beeing neutral ngo making browser for people and not for making cloged systems so new computers could be sold by some company advice or infiltrated mole who will suggest such unneded feature as any other addons, but sticking it in for everyone.

    Hello,
    You can download version 28 from here:
    https://ftp.mozilla.org/pub/mozilla.org/firefox/releases/28.0/
    Also, you'll have to disable auto updates to remain with version 28 by following the steps described in this support article:
    https://support.mozilla.org/en-US/kb/advanced-settings-browsing-network-updates-encryption#w_update-tab

  • How to Map Proces form field with Resource form field?

    Hi,
    How to Map Proces form field with Resource form field while creating Process form in Form designer

    Are you talking about Provisioning ?
    then you do that in Data Flow under Process Defintion in OIM 10g
    In OIM 11g you use Request Dataset. In that you can directly map fields to process form.

Maybe you are looking for