-1

I have a form that is need to be passed to my CRM.

the form is simple and contains 2 important fields that defines under what category the data will be received in my crm.

<form method="post" action="http://api.leadmanager.co.il/v1/submit" id="lm_form"> 
 <input type="hidden" name="lm_form" value="5750" /> 
 <input type="hidden" name="lm_key" value="cc0ce4fe280e46e986e5716f9feedaab" /> 
 <input type="hidden" name="lm_tyt" value="" />
 <input type="submit" value="submit"/>
 </form>

I want to add a drop down list with 2 options first will send the form i mentiond above as is.

the second will modify the values of "lm_key" and "lm_form" to other values.

TheSwiss
  • 35
  • 5
  • Okay, when you started writing that script where did you get stuck? What, specifically, do you want help with? – David Thomas Jun 29 '14 at 17:14
  • I need help adding a selector + help adding the javascript code that will set my values. – TheSwiss Jun 29 '14 at 17:18
  • Maybe this will help http://stackoverflow.com/questions/3487263/how-to-use-onclick-or-onselect-on-option-tag-in-jsp-page – t.animal Jun 29 '14 at 17:21
  • @strekoz thank you, but i want the script to change two values, not only one. can you please explain how to make a script that changes both lm_form and lm_key ?thanks. – TheSwiss Jun 30 '14 at 12:57

1 Answers1

0

Plain JS code can be like this. But I would advice you to use some JS library like JQuery, AngulerJS or another one.

<form method="post" action="http://api.leadmanager.co.il/v1/submit" id="lm_form" name="form"> 
 <input type="hidden" name="lm_form" value="5750" /> 
 <input type="hidden" name="lm_key" value="cc0ce4fe280e46e986e5716f9feedaab" /> 
 <input type="hidden" name="lm_tyt" value="" />
 <select name="selectField" onchange="changeValues()">
     <option value="1">1</value>
     <option value="2">2</value>
 </select>
 <input type="submit" value="submit"/>
 </form>

<script>
    function changeValues() {
        form.lm_key.value = form.selectField.value;
        form.lm_form.value = form.selectField.value;
    }
</script>
StrekoZ
  • 618
  • 6
  • 12