[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Jquery: alert() when submit with default value

Posted on 2009-04-20
3
Medium Priority
?
5,180 Views
Last Modified: 2012-06-27
how to put jquery script with message to change the default value for user (to the script below):

"<script>$(document).ready(function(){
alert ("helloworld");
});</script>"
<% if $display == 1 OR $_URL == $URL %>
	<script>$(document).ready(function(){$("#search").click(function(){$("#search_form").slideToggle("slow")})});</script>
	<script type="text/javascript">$(document).ready(function(){$("#bc").bind("change",function(){if(this.value=="1"){$("#c").attr("disabled",true)}else{$("#c").attr("disabled",false)}});$("#bc").change()});</script>
	<div id=search_form class='clear rel pad-left1 window<% if $display_show == '' %> none<% /if %>'>
	<form action=<% $URL %>catalogs/ method=GET name=searchform>
		<script>jQuery(function($){$("#t").Watermark("search\u00A0<% include file = $TPLx.'bl/if_search/index2.html' %>","#ccc")});</script>
			<input type=text name=t id=t size=54 />
			<% if $_URL == $URL %>
		  <select name=bc id=bc class=cc>
		  	<option value=''>&ndash;&nbsp;Select Category&nbsp;&ndash;</option>
		  	<% foreach from = $bc key = k  item = v %><option value=<% $bc[$k][id] %><% if $GET[bc] == $bc[$k][id] %> selected<% /if %>><% $bc[$k][t] %></option><% /foreach %>
		  </select>
		  <% /if %>
		  
			<select name=c id=c class=ccc<% if $_GET[0] == 'catalogs' OR $_GET[0] == '' %><% else %> disabled<% /if %>>
				<option value=''>&ndash; <% if $_GET[0] == 'catalogs' OR $_GET[0] == '' %><% else %>All&nbsp;<% /if %><% include file = $TPLx.'bl/if_search/index.html' %>&nbsp;&ndash;</option>
				<% foreach from = $c  key = k  item = v %><option value=<% $c[$k][id] %><% if $GET[c] == $c[$k][id] %> selected<% /if %>><% $c[$k][t] %></option><% /foreach %>
			</select>
			<a href=# onclick=document.searchform.submit(); class='fg-button button-small ui-state-default fg-button-icon-right ui-corner-all'>search</a>&nbsp; <a href=#>advanced search</a><br />
			<span class='bold'>Your recent searches:</span>&nbsp; <span class=dsc>none</span> <a href=#>AA</a>, <a href=#>ethanol</a>
	</form>
	</div>
	<% /if %>

Open in new window

0
Comment
Question by:AndyPSV
  • 2
3 Comments
 
LVL 10

Accepted Solution

by:
mstrelan earned 2000 total points
ID: 24221848
Store the defaults in a javascript array. Then onsubmit test each input against its default value until you get a mismatch. At that point alert the user and return false.

Is that what you're wanting to do?
0
 

Author Comment

by:AndyPSV
ID: 24405712
Yes, could you give me the javascript code?
0
 

Author Closing Comment

by:AndyPSV
ID: 31572575
answer not needed, thanks btw
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses
Course of the Month18 days, 8 hours left to enroll

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question