Javscript alert...

Results 1 to 6 of 6

Thread: Javscript alert...

  1. #1
    Join Date
    Dec 1969
    Posts
    1,323

    Default Javscript alert...

    In this code...how do I detect if the user has selected OK and then submit the form...if they hit cancel, i want to return false... This is just the bottom portion of the code.<BR><BR>Thanks<BR><BR> if (!validRequired(document.fUserSearch.password,"Pas sword"))<BR> return false;<BR> <BR> if (!validRequired(document.fUserSearch.department,"D epartment"))<BR> return false;<BR> <BR> window.confirm(&#039;Are you sure you want to delete user?&#039;);<BR> // &#060;--------- End<BR> return true;<BR> var sAction = &#039;deleteusers.asp?a=&#039;;<BR> sAction += String(s);<BR> fUserSearch.action = sAction;<BR> fUserSearch.submit();<BR> }

  2. #2
    Join Date
    Dec 1969
    Posts
    18,177

    Default RE: Javscript alert...

    if(confirm(&#039;whatever&#039;))<BR>{<BR> dosomething_like submit the form;<BR> return true;<BR>}<BR>else<BR>{<BR> return false;<BR>}<BR><BR>But, how are you calling this JavaScript function? (will affect what you do in the event they click "Ok").

  3. #3
    Join Date
    Dec 1969
    Posts
    1,323

    Default RE: In the onclick event of the button

    &#060;input type="button" id="Delete" value=" Delete " name="bDelete" onclick="return validateForm(this,4);"&#062;&nbsp;<BR><BR>like so...is that correct?

  4. #4
    Join Date
    Dec 1969
    Posts
    18,177

    Default Yep. That's fine. (eop)

    .


  5. #5
    Join Date
    Dec 1969
    Posts
    1,323

    Default RE: Having a problem...

    I have the following...<BR><BR> &#060;SCRIPT language="javascript"&#062;<BR> function validateForm(theForm,s)<BR> {<BR> // Customize calls for form<BR><BR> // Start -------&#062;<BR> <BR> if (!validRequired(document.fUserSearch.firstname,"Fi rst Name"))<BR> return false;<BR> <BR> if (!validRequired(document.fUserSearch.lastname,"Las t Name"))<BR> return false;<BR> <BR> if (!validRequired(document.fUserSearch.username,"Use rname"))<BR> return false;<BR> <BR> if (!validRequired(document.fUserSearch.password,"Pas sword"))<BR> return false;<BR> <BR> if (!validRequired(document.fUserSearch.department,"D epartment"))<BR> return false;<BR> <BR> x=window.confirm(&#039;Are you sure you want to delete user?&#039;)<BR> if x == true<BR> {<BR> var sAction = &#039;deleteusers.asp?a=&#039;;<BR> sAction += String(s);<BR> fUserSearch.action = sAction;<BR> fUserSearch.submit();<BR> }<BR> else<BR> {<BR> return false;<BR> }<BR> <BR> // &#060;--------- End<BR> return true;<BR> &#060;/SCRIPT&#062;<BR><BR>and I call it from here<BR><BR>onclick="return validateForm(this,4);<BR><BR>But nothing is working. i have tried vaious things, but either I get object expected error or no form submit. Any ideas on what my problem is? Thanks alot.<BR><BR>Harry C

  6. #6
    Join Date
    Dec 1969
    Posts
    1,323

    Default Got it, thanks...<eop>

    .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •