Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 266
  • Last Modified:

Help!!!! Toggle Menu

Hi,

this is my site.
http://www.churchesbulletin.com/post.cfm?CHID=11

I am having problem with my left toggle menu.  

I am not sure why when I select "search by state" button I enter anything in the search text box and select michigan then click on the search button.

it does not submit the form and the search by state menu it closes.  

I want it to stay open and to be able to submit my selection.

Thanks,
lulu
<input id="BtnST" type="button" value="Search" name="BtnST" onclick="valState();"/>


	
function valState(){

var errorMsg = "";
var errorField = null;

var DcFrm = document.FRMAcc;

 if (DcFrm.TxtSearchST.value == ""){
      errorMsg += "Search for field is empty\n";
	if (errorField==null) errorField=FRMAcc.TxtSearchST;
  }
  
if (DcFrm.DispStateBoxST.selectedIndex == 0)
{
  errorMsg += "Select a state\n";
  if (errorField==null) errorField=FRMAcc.DispStateBoxST;
 }

  if (errorMsg != "") {
    errorMsg += "---------------------------------\n\n";
    errorMsg += "Please correct the problem(s)\n";
    alert(errorMsg );
    errorField.focus();
    return false;
  } 
  
	FRMAcc.method="post"; 
	FRMAcc.action="post.cfm?CHID=" + '<cfoutput>#URL.CHID#</cfoutput>';
	FRMAcc.submit(); 
 
}

Open in new window

0
lulu50
Asked:
lulu50
  • 8
  • 5
1 Solution
 
leakim971PluritechnicianCommented:
your button : <input id="BtnCT" type="button" value="Search" name="BtnCT" onclick="return valCity();">

your function must return true or false (ok) :
check at the end of your function :
      
function valState(){

var errorMsg = "";
var errorField = null;

var DcFrm = document.FRMAcc;

 if (DcFrm.TxtSearchST.value == ""){
      errorMsg += "Search for field is empty\n";
      if (errorField==null) errorField=FRMAcc.TxtSearchST;
  }
 
if (DcFrm.DispStateBoxST.selectedIndex == 0)
{
  errorMsg += "Select a state\n";
  if (errorField==null) errorField=FRMAcc.DispStateBoxST;
 }

  if (errorMsg != "") {
    errorMsg += "---------------------------------\n\n";
    errorMsg += "Please correct the problem(s)\n";
    alert(errorMsg );
    errorField.focus();
    return false;
  }
 
      FRMAcc.method="post";
      FRMAcc.action="post.cfm?CHID=" + '<cfoutput>#URL.CHID#</cfoutput>';
      FRMAcc.submit();

return true;

}
0
 
lulu50Author Commented:
leakim971:

Thank you for helping me.  

I did changed it to onclick="return valCity();">
and at the bottom return true;

I am still not able to post for some reason.  

Do you think because of my left menu once I click on the submit button in the "search by state" it reload the page and closes my menu?

when the user click on one of the free button I want the menu to stay open unless the user change
the selection.

I know I have to do something in this code but what and how I have no idea.


<script>

$(document).ready(function() {
    $(".divMain").click(function(){
        $(".divSub").hide();
        $(this).next(".divSub:eq(0)").show(50);
    });
});

</script>



0
 
leakim971PluritechnicianCommented:
I'm still seeing : <input id="BtnCT" type="button" value="Search" name="BtnCT" onclick="valCity();">
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
leakim971PluritechnicianCommented:
my bad I tried by city...
0
 
leakim971PluritechnicianCommented:
Your is successfully submitted on my side
0
 
leakim971PluritechnicianCommented:
Your form is successfully submitted on my side
0
 
leakim971PluritechnicianCommented:
on a previous question I said replace :

<script type="text/javascript" src="JS/jquery.min.js"></script>
<script type="text/javascript" src="JS/jquery-latest.min.js"></script>  

by :

<script type="text/javascript" src="JS/jquery-latest.min.js"></script>  
0
 
lulu50Author Commented:
to test if the form getting submitted I put this:
------------------------------------
I Entered in my text box this:
<cfif isdefined("form.BtnST")>
      <cfoutput>#form.TxtSearchST#</cfoutput>
</cfif>
------------------------------------
it's on the top of the page

I should see what I entered in my state text box.

I am getting anything

I replaced my javascript files like you said.

how can I make my left menu by default to open
search by church menu
and
when the user click on any other button to keep the menu open until they chose a different one.


something need to change in here

<script>

$(document).ready(function() {
    $(".divMain").click(function(){
        $(".divSub").hide();
        $(this).next(".divSub:eq(0)").show(50);
    });
});

</script>

but I don't know what.

0
 
lulu50Author Commented:
leakim971:

for testing to see the form is getting submitted I did this:

clicked on Search by state

in my search box I put Maya
and selected MI then clicked on submit

the page got reloaded I opened the view source
and searched for "Maya" I cannot find "Maya"

If the form has been submitted I should see "Maya"
no?

what do you think?    menu
0
 
leakim971PluritechnicianCommented:
try with something else than the button, for example TxtSearchST
0
 
leakim971PluritechnicianCommented:

------WebKitFormBoundaryTqTxf0hnuKYv3Mty
Content-Disposition: form-data; name="TxtSearchST"

tototo
------WebKitFormBoundaryTqTxf0hnuKYv3Mty
Content-Disposition: form-data; name="TxtStateST"


------WebKitFormBoundaryTqTxf0hnuKYv3Mty
Content-Disposition: form-data; name="DispStateBoxST"

22
------WebKitFormBoundaryTqTxf0hnuKYv3Mty
Content-Disposition: form-data; name="SelSTPost"


------WebKitFormBoundaryTqTxf0hnuKYv3Mty
Content-Disposition: form-data; name="SelCatg"


------WebKitFormBoundaryTqTxf0hnuKYv3Mty
Content-Disposition: form-data; name="SelStDt"


------WebKitFormBoundaryTqTxf0hnuKYv3Mty
Content-Disposition: form-data; name="dateFromST"


------WebKitFormBoundaryTqTxf0hnuKYv3Mty
Content-Disposition: form-data; name="dateToST"


------WebKitFormBoundaryTqTxf0hnuKYv3Mty
Content-Disposition: form-data; name="PriceFromST"


------WebKitFormBoundaryTqTxf0hnuKYv3Mty
Content-Disposition: form-data; name="PriceToST"


------WebKitFormBoundaryTqTxf0hnuKYv3Mty
Content-Disposition: form-data; name="TxtSearchCT"


------WebKitFormBoundaryTqTxf0hnuKYv3Mty
Content-Disposition: form-data; name="TxtStateCT"


------WebKitFormBoundaryTqTxf0hnuKYv3Mty
Content-Disposition: form-data; name="DispStateBoxCT"


------WebKitFormBoundaryTqTxf0hnuKYv3Mty
Content-Disposition: form-data; name="TxtCityCT"


------WebKitFormBoundaryTqTxf0hnuKYv3Mty
Content-Disposition: form-data; name="SelSTPostCT"


------WebKitFormBoundaryTqTxf0hnuKYv3Mty
Content-Disposition: form-data; name="SelCatCT"


------WebKitFormBoundaryTqTxf0hnuKYv3Mty
Content-Disposition: form-data; name="SelDtCT"


------WebKitFormBoundaryTqTxf0hnuKYv3Mty
Content-Disposition: form-data; name="dateFromCT"


------WebKitFormBoundaryTqTxf0hnuKYv3Mty
Content-Disposition: form-data; name="dateToCT"


------WebKitFormBoundaryTqTxf0hnuKYv3Mty
Content-Disposition: form-data; name="PriceFromCT"


------WebKitFormBoundaryTqTxf0hnuKYv3Mty
Content-Disposition: form-data; name="PriceToCT"


------WebKitFormBoundaryTqTxf0hnuKYv3Mty
Content-Disposition: form-data; name="TxtSearchCH"


------WebKitFormBoundaryTqTxf0hnuKYv3Mty
Content-Disposition: form-data; name="TxtState"


------WebKitFormBoundaryTqTxf0hnuKYv3Mty
Content-Disposition: form-data; name="DispStateBox"


------WebKitFormBoundaryTqTxf0hnuKYv3Mty
Content-Disposition: form-data; name="TxtCity"


------WebKitFormBoundaryTqTxf0hnuKYv3Mty
Content-Disposition: form-data; name="TxtChurch"


------WebKitFormBoundaryTqTxf0hnuKYv3Mty
Content-Disposition: form-data; name="GetChurch"


------WebKitFormBoundaryTqTxf0hnuKYv3Mty
Content-Disposition: form-data; name="SelSTPost"


------WebKitFormBoundaryTqTxf0hnuKYv3Mty
Content-Disposition: form-data; name="SelCatCh"


------WebKitFormBoundaryTqTxf0hnuKYv3Mty
Content-Disposition: form-data; name="SelDtCh"


------WebKitFormBoundaryTqTxf0hnuKYv3Mty
Content-Disposition: form-data; name="dateFromCh"


------WebKitFormBoundaryTqTxf0hnuKYv3Mty
Content-Disposition: form-data; name="dateToCh"


------WebKitFormBoundaryTqTxf0hnuKYv3Mty
Content-Disposition: form-data; name="PriceFromCh"


------WebKitFormBoundaryTqTxf0hnuKYv3Mty
Content-Disposition: form-data; name="PriceToCh"


------WebKitFormBoundaryTqTxf0hnuKYv3Mty
Content-Disposition: form-data; name="txtQSearch"


------WebKitFormBoundaryTqTxf0hnuKYv3Mty
Content-Disposition: form-data; name="SortData"

 
------WebKitFormBoundaryTqTxf0hnuKYv3Mty
Content-Disposition: form-data; name="RadioGroup1Adv"

0
------WebKitFormBoundaryTqTxf0hnuKYv3Mty
Content-Disposition: form-data; name="CHID"

11
------WebKitFormBoundaryTqTxf0hnuKYv3Mty--

Open in new window

0
 
lulu50Author Commented:
leakim971:

you are right the form is getting submitted.  
I just have to change my logic to get it to work.

as for the second question I need to open a new question for it.

I am not good with Jquery I need your help with my new question.

thank you
lulu
0
 
lulu50Author Commented:
Thank you for helping me
A++++++++++++++++++++++++++++++
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 8
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now