I have a webpage, I’m building in vb.net. The page lists worship locations for parishes. At the bottom of the list is a link to add a new location. When the link is clicked, a modal window appears containing a form. The form is completed and submitted to a separate page for processing. Upon return, the new location is on the list.
Next to each location is a link, “Edit”. I want to load the location information into the modal window so the user can make changes and submit them to a processing page.
In order to get the modal window to open I use:
<a href="#AddWS"" class="texttrigger" data-toggle="modal">Add Worship Site</a>
I want to have the edit link call a piece of javascript in order to place the location info into a hidden form at the bottom of the page and submit with action=”thispage.aspx#editWS”. The URL in the address bar upon submission is correct but the modal window does not display.
<a href=""javascript:editWS(185)"" >Edit</a>
function editWS(LID) {
if (LID == 185) {
document.editLocation.ID.value = 185;
document.editLocation.address.value = "123 Anywhere St.";
document.editLocation.city.value = "clairmont";
document.editLocation.state.value = "NY";
document.editLocation.zip.value = "11111";
document.editLocation.phone.value = "(012) 888-1682";
document.editLocation.county.value = "8";
document.editLocation.vicariate_ID.value = "4";
document.editLocation.SeatingCapacity.value = "200";
document.editLocation.submit();
}
if (LID == 220) {
document.editLocation.ID.value = 220;
document.editLocation.address.value = "6 Main St.";
document.editLocation.city.value = "cloverfield";
document.editLocation.state.value = "NY";
document.editLocation.zip.value = "22222";
document.editLocation.phone.value = "(333) 622-3191";
document.editLocation.county.value = "6";
document.editLocation.vicariate_ID.value = "4";
document.editLocation.SeatingCapacity.value = "";
document.editLocation.submit();
}
}
<form name="editLocation" action="thispage.aspx#editWS" method="post">
<input type="hidden" name="ID" value="" />
<input type="hidden" name="address" value="" />
<input type="hidden" name="city" value="" />
<input type="hidden" name="state" value="" />
<input type="hidden" name="zip" value="" />
<input type="hidden" name="phone" value="" />
<input type="hidden" name="county" value="" />
<input type="hidden" name="vicariate_ID" value="" />
<input type="hidden" name="SeatingCapacity" value="" />
</form>
In the modal window, I plan to load the data from the form object.The user can then update the info and submit it to a processing page.