Hi,
I have made form with some javascript show/hide divs. I'm using this script:
and I have a form (part of it where script aplies)..
So this script is working OK. I have a problem with email templates. When I use to print out selected option ("selectMenu") it prints out values (value="9A", value="10A", value="11A"). I wonder if I could add some "name" tags to option.
Like this:
and to get printed in email name tag and not value.
Is this possible? Or can someone change javascript to make it working with random id's. Now it's made with continous 1xx,2xx,3xx,4xx....
Thanks in advance!
I have made form with some javascript show/hide divs. I'm using this script:
//*********************************************
// Function that Shows an HTML element
//*********************************************
function showDiv(divID)
{
var div = document.getElementById(divID);
div.style.display = ""; //display div
}
//*********************************************
// Function that Hides an HTML element
//*********************************************
function hideDiv(divID)
{
var div = document.getElementById(divID);
div.style.display = "none"; // hide
}
//*****************************************************************************
// Function that Hides all the Div elements in the select menu Value
//*****************************************************************************
function hideAllDivs()
{
//Loop through the seclect menu values and hide all
var selectMenu = document.getElementById("selectMenu");
for (var i=0; i<=selectMenu.options.length -1; i++)
{
hideDiv(selectMenu.options[i].value);
}
}
//*********************************************
// Main function that calls others to toggle divs
//*********************************************
function toggle(showID)
{
hideAllDivs(); // Hide all
showDiv(showID); // Show the one we asked for
}
and I have a form (part of it where script aplies)..
<div class="form_item">
<div class="form_element cf_dropdown">
<label class="cf_label" style="width: 150px;">Število oseb:</label>
<select id="selectMenu" name="selectMenu" onchange="toggle(this.options[this.options.selectedIndex].value)">
<option value="9A"> 1 oseba </option>
<option value="10A"> 2 osebi </option>
<option value="11A"> 3 osebe </option>
</select>
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_textbox">
<label class="cf_label" style="width: 150px;">1. Ime in priimek:</label>
<input class="cf_inputbox" maxlength="150" size="30" title="" id="text_3" name="text_3" type="text" />
</div>
<div class="cfclear"> </div>
</div>
<div id="9A" style="display:none"></div>
<div id="10A" style="display:none">
<div class="form_item">
<div class="form_element cf_textbox">
<label class="cf_label" style="width: 150px;">2. Ime in priimek:</label>
<input class="cf_inputbox" maxlength="150" size="30" title="" id="text_9" name="text_9" type="text" />
</div>
<div class="cfclear"> </div>
</div>
</div>
<div id="11A" style="display:none">
<div class="form_item">
<div class="form_element cf_textbox">
<label class="cf_label" style="width: 150px;">2. Ime in priimek:</label>
<input class="cf_inputbox" maxlength="150" size="30" title="" id="text_18" name="text_18" type="text" />
</div>
<div class="cfclear"> </div>
</div>
<div class="form_item">
<div class="form_element cf_textbox">
<label class="cf_label" style="width: 150px;">3. Ime in priimek:</label>
<input class="cf_inputbox" maxlength="150" size="30" title="" id="text_9" name="text_9" type="text" />
</div>
<div class="cfclear"> </div>
</div>
</div>
So this script is working OK. I have a problem with email templates. When I use to print out selected option ("selectMenu") it prints out values (value="9A", value="10A", value="11A"). I wonder if I could add some "name" tags to option.
Like this:
<div class="form_item">
<div class="form_element cf_dropdown">
<label class="cf_label" style="width: 150px;">Število oseb:</label>
<select id="selectMenu" name="selectMenu" onchange="toggle(this.options[this.options.selectedIndex].value)">
<option value="9A" name="random text"> 1 oseba </option>
<option value="10A" name="random text"> 2 osebi </option>
<option value="11A" name"random text">3 osebe </option>
</select>
</div>
<div class="cfclear"> </div>
</div>
and to get printed in email name tag and not value.
Is this possible? Or can someone change javascript to make it working with random id's. Now it's made with continous 1xx,2xx,3xx,4xx....
Thanks in advance!