Jump to content

tdwilson

Members
  • Posts

    17
  • Joined

  • Last visited

tdwilson's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Hello Bahar, Thank you for looking at the code; after working on it myself for untold hours, I suspected it may not be possible to assign a value to a pre-selected option in a drop-down. The hidden field idea sounds good. I'll keep that tip in mind for future projects. Also, a while back I looked into the method to add a new option to a dropdown (via the article you mentioned), but found it would not work for my needs because it clears all previous information. Here is a note from the article: "In Internet Explorer, if you are using this method in a submission form, after submitting a new dropdown option any information in the original form will be cleared, for that reason it is a good idea to add a dynamic dropdown link as close to the top of the form as possible." My final solution was to build and give my users a choice of datapages to use. One for existing customers and another for adding new customers. It works fine for everybody, however it does cost me a datapage. Again, thank you for taking the time to work on my code. Best regards, Terry
  2. Hi, I redeployed it: https://b2.caspio.com/dp.asp?AppKey=1da ... 89402a85d3 Thanks for looking at it for me. TD
  3. Dear bahar_vm, I undeployed the page on 11/23, please let me know if you needed more time and I can redeploy it for a few more days. Very Best regards, TD Wilson
  4. Yes, Here is a Test Version. https://b2.caspio.com/dp.asp?AppKey=1da ... 89402a85d3 If you submit something, please use the initial "ZB" and place your email address in the Notes area so I can send you a copy of the results. The "Add New Company" is the first name in the Company Dropdown list. Thank you, Terry
  5. Sorry, But last suggestion did not work. I double checked all the names and elements with Firebug. The code makes sense but the results are still the same. The New name is not transfering to the Company field. Thanks for the help.
  6. Well... I tried the suggestion and reviewed my code, but still could not get it to work. I did notice I had my getElementById('caspioform'); wrong. It should have been ('caspioform') not ("caspioform") Thanks for your help. Here is the latest.... -------------------------------------------------- function init() { var form = document.getElementById('caspioform'); form.onsubmit = function() { return processForm(); } } function processForm() { var form = document.getElementsByName('AppKey'); var o_Cust1 = document.getElementsByName("InsertRecordCompany"); var o_CustNew = document.getElementsByName("InsertRecordNew"); if(o_Cust1[0].value == "Add New Company") { o_Cust1[0].value = o_CustNew.value; } else { o_Cust1[0].value = o_Cust1[0].value; } return true; } window.onload = init;
  7. Well, It still did not work. Actually I remember I tried that method earlier. One thing I did learn form Caspio support was you should always refer to the Caspio document as: document.getElementById('caspioform'); Not document.getElementsByName('AppKey'); Thanks for the help. Here is the code for my last try: function init() { var form = document.getElementById("caspioform"); form.onsubmit = function() { return processForm(); } } function processForm() { var form = document.getElementsByName('AppKey'); var o_Cust1 = document.getElementsByName("InsertRecordCompany")[0]; var o_CustNew = document.getElementsByName("InsertRecordNew"); if(o_Cust1.value == "Add New Company") { o_Cust1.value = o_CustNew.value; } else { o_Cust1.value = o_Cust1.value; } return true; } window.onload = init;
  8. Okay, that makes sense. I'll give it a try over the weekend and let you know how it works out. I had given up on the project and was having my users go to 2 other forms to get the data in. Thank you for your help, Terry
  9. Guess what, the solution is not a JavaScript script. Reason... There are too many wild things happening in cascading drop downs and JavaScript is not the solution, it cannot capture the data in the cascading field. There are work-arounds for what I was trying to do, but they involve passing parameters to other forms and redirecting back to the original form. I want to thank everybody who tried to help me. But it is time to end this post and move on. TD Wilson 10/13/2010
  10. Here's my latest try. In the source code I noticed the name of the form was not "Caspio", but "Appkey". However the code still does not work. The o_Cust1 element is a cascading dropdown. ------- function init() { var form = document.getElementsByName('AppKey'); form.onsubmit = function() { return processForm(); } } function processForm() { var form = document.getElementsByName('AppKey'); var o_Cust1 = document.getElementsByName("InsertRecordCompany"); var o_CustNew = document.getElementsByName("InsertRecordNew"); if(o_Cust1.value == "Add New Company") { o_Cust1.value = o_CustNew.value; } else { o_Cust1.value = o_Cust1.value; } return true; } window.onload = init;
  11. Good news, problem solved. The trick was to look at the source code from Caspio; since this was a drop-down calling data from another table, it was an options call. Here is the working solution: function init() { var form = document.getElementById('caspioform'); form.onsubmit = function() { return processForm(); } } function processForm() { var form = document.getElementById('caspioform'); var o_Cust1 = document.getElementById("InsertRecordCustomer"); var o_CustNew = document.getElementById("InsertRecordNew_Customer"); if(o_Cust1.value == "Add New Customer") { o_Cust1.options[0] = new Option(o_CustNew.value, o_CustNew.value, false, true); } else { o_Cust1.value = o_Cust1.value; } return true; } window.onload = init; ------------------------- However now I have a new problem with another database. Same scenario except it uses cascading dropdowns. I opened a new question on the baord. Any help? Look for question: JavaScript getElementsByName, cascading drop box problem I cannot seem to get the getElementsByName to work for me. Thanks, TDW
  12. Oops, I took another look at the source code and it is not a select/options list. Here is the source code: Company So, does anybody have any suggestions? Here is my latest attempt without the options part in the code. ------------------------- function init() { var form = document.getElementsByName('caspioform'); form.onsubmit = function() { return processForm(); } } function processForm() { var form = document.getElementsByName('caspioform'); var o_Cust1 = document.getElementsByName("InsertRecordCompany"); var o_CustNew = document.getElementsByName("InsertRecordNew"); if(o_Cust1.value == "Add New Company") { o_Cust1.value = o_CustNew.value; } else { o_Cust1.value = o_Cust1.value; } return true; } window.onload = init;
  13. I have a "Submit" form that I cannot get to work. I think the problem may be in the "getElementsByName" part of the javaScript because I can get the code to work in another form where I can use "getElementById". The other form has a normal dropdown field with a stable id name, unlike the cascading fields that change all the time (hence the getElementsByName usage. Can anybody spot where the problem may be in the following script? What it does is... The cascading dropdown (Company) finds customers related to a salesperson. If they have a new company to add, they bypass the cascading dropdown field and input the new company name in a textfield (New). When they bypass the Customer field, it automatically inputs "Add New Company" into the Company field. I use that as part of my script below. P.S. I can look at the source code and see that the cascading field is a select/options list. --------------------------------------- function init() { var form = document.getElementsByName('caspioform'); form.onsubmit = function() { return processForm(); } } function processForm() { var form = document.getElementsByName('caspioform'); var o_Cust1 = document.getElementsByName("InsertRecordCompany"); var o_CustNew = document.getElementsByName("InsertRecordNew"); if(o_Cust1.value == "Add New Company") { o_Cust1.options[0] = new Option(o_CustNew.value, o_CustNew.value, false, true); } else { o_Cust1.value = o_Cust1.value; } return true; } window.onload = init;
×
×
  • Create New...