Jump to content

financemy

Members
  • Posts

    8
  • Joined

  • Last visited

financemy's Achievements

  1. Found out that this is "by design" When a control is hidden by a rule, the value is not saved in the table on InsertRecord. Unhiding the control means that the value is saved When a control is hidden by javascript, or via marking it "hidden" in the control type, the value is saved in the table on InsertRecord Hopefully this helps others Mark
  2. Hi all, I've got a very frustrating problem that I can't seem to solve, and it's driving me nuts. Form is http://www.createafoundation.org/enquire In my insert record form, I have a field called "caf_code" that is hidden dropdown list populated from a view (hidden by a rule on the datapage). I pass a variable to the form (via a cookie and some js) that sets the index of the dropdown list depending on the variable value. This works fine, and I can query the javascript console to confirm that the dropdown has the right index and value even though it is hidden. Now, when I submit the form, the value doesn't carry through to the table ... there is a blank field instead of the dropdown value. If I now unhide the dropdown (using another control and another rule on the datapage) and submit the form, the value gets updated with the dropdown value correctly. I tested both hidden and unhidden with the javascript console, and each time they report the same index and value... but only the "unhidden" scenario ends up with data in the right field. This is really frustrating and I'm not sure where to go to from here. Everything else seems to work OK... Javascript code attached: <script type="text/javascript"> //this is the dropdown, hidden by a datapage rule var c = document.getElementById("InsertRecordcaf_code"); //currently selected index var sel = c.selectedIndex; //number of entries var all = c.options.length; var i=0; // get the variable in the cookie var cookie_caf = readCookie("CAF_code"); //if there is no cookie, set to a default value if (cookie_caf == "") { cookie_caf = "3MAC"; } //now iterate through dropdown and find matching entry var list_caf = c.options[sel].text; if (cookie_caf != list_caf) { for (i = 0; i < all; i++) { if (c.options[i].text == cookie_caf) { //found it - make it the selected entry c.options[i].selected = true; break; } } } else { //is first entry on the list c.options[0].selected = true; } //set up partner email value document.getElementById("InsertRecordpartner_email").value = cookie_caf+ "@createafoundation.org"; //extract partner code for email document.getElementById("cbParamVirtual1").value = c.options[i].text; //set up functions for changing of dropdowns document.getElementById("InsertRecordcaf_code").onchange = caf_changed; document.getElementById("cbParamVirtual2").onchange = got_caf_changed; //dropdown for partner code function caf_changed() { // caf code has changed - update other fields document.getElementById("InsertRecordpartner_email").value = document.getElementById("InsertRecordcaf_code").options[document.getElementById("InsertRecordcaf_code").selectedIndex].value+"@createafoundation.org"; document.getElementById("cbParamVirtual1").value = document.getElementById("InsertRecordcaf_code").options[document.getElementById("InsertRecordcaf_code").selectedIndex].value; } //dropdown for 'do you have a partner code' function got_caf_changed() { if (document.getElementById("cbParamVirtual2").value == "No") { //set default email document.getElementById("InsertRecordpartner_email").value = "3MAC@createafoundation.org"; //find default in the dropdown and select for (i = 0; i < all; i++) { if (document.getElementById("InsertRecordcaf_code").options[i].text == "3MAC") { document.getElementById("InsertRecordcaf_code").options[i].selected = true; document.getElementById("cbParamVirtual1").value = document.getElementById("InsertRecordcaf_code").options[i].text; break; } } } } </script>
  3. Thanks Chad - let me digest this and I'll post back Cheers Mark
  4. Hey Iren, thanks for the reply. I'd much rather keep the directors in a separate table and use a foreign key to join - much better database and programming practice. The number of directors can vary - from 1 up to 5. Imagine if they were employees instead - there could be anywhere from 1 to hundreds per company and that would make a flat file pretty difficult to manager Cheers Marl
  5. Hi there, I've got an application that allows for a company to self-register to a service. All company-relevant information goes into the Companies table and they can edit this as needed. This functionality is pretty straightforward in Caspio, but now I want to extend it. I'd like to capture details on the company directors during the registration process. The intent would be to have a dropdown asking for the number of company directors, and then provide a form (or forms) to gather the name, email, contact details etc of each one (either all together or consecutively). These details will go into a table cleverly called Directors, and these new records will include a foreign key for the company record. I've searched the help topics and forum pages with no joy on this. I did have the idea of using javascript to pick up a "num_directors" parameter passed into a data page, then build N sets of submission forms that would be needed, then use javascript again to submit each form consecutively ... maybe even using multiple published iframes on the data page ... but haven't tested any of these Does anyone have any suggestions on how this could be accomplished? I've got a second application that needs the same style of approach too Thanks Mark
  6. After letting this bubble around my brain for a while (which didn't take long ) I solved it by just doing a SQL inner join in a calculated field: SELECT name FROM fm_intervals WHERE fm_intervals.value = [@field:client1_income_interval] Makes much more sense to do it this way - it is far more elegant and allows me to make changes to my table without having to change my datapage each time.
  7. Hi Jan, thanks for the reply - yes that works, however only for the first looked up value in the view that is from the same lookup table. One of my tables uses duration/name pairs (e.g. 1/Yearly, 12/Monthly, 4/Quarterly, 365/Daily etc) and this is used multiple times on the datapage report detail (income and expenses for a client). I can join the first duration entry fine (and it works) but subsequent ones result in a view with no data. Caspio support suggest s using virtual fields and rules to hide or show the text; to me this isn't very elegant as it negates good database and programming practice for a lookup table rather than hard coding values Thanks Mark
  8. Hi there - quick question about relationships. I've created a relationship between two tables using the Relationship Settings dialog, and set the "Value for display in Related Field" to the desired field. This works great - in the table view, I can see this lookup happening no problems (this substitutes the integer values 0/1 for the text values "Single"/"Married"). When I use the table as a datasource for a Report Details Datapage, I see the original value ("0"), not the looked-up one ("Single"). Is this by design? How can I set the report to show the looked up value, not the original? Thanks Mark
×
×
  • Create New...