Search Results

Search found 6055 results on 243 pages for 'forms'.

Page 50/243 | < Previous Page | 46 47 48 49 50 51 52 53 54 55 56 57  | Next Page >

  • jQuery form zip code to state function

    - by Dakota R.
    I'm trying to convert a preexisting javascript function into a jQuery function. The function comes from http://javascript.internet.com/forms/zip-to-state.html and aims to convert a user-entered zip code into a state. I'm using jQuery 1.3.2, with all the necessary plugins, but I'm not very familiar with jQuery syntax and how to convert this from plain ol' Javascript syntax. The setState function takes two parameters, the zip code element and the state element, so I'm trying to do something like this: $('$zip_code').change( function () { setState($(this), $('#state')); }); Any thoughts on this syntax? Thanks, Dakota function getState(zip) { if ((parseInt(zipString.substr(zip / 4, 1), 16) & Math.pow(2, zip % 4)) && (zip.length == 5)) for (var i = 0; i < stateRange.length; i += 7) if (zip <= 1 * stateRange.substr(i, 5)) return stateRange.substr(i + 5, 2); return null; } function setState(txtZip, optionBox) { if (txtZip.value.length != 5 || isNaN(txtZip.value / 4)) { optionBox.options[0].selected = true; alert("Please enter a 5 digit, numeric zip code."); return; } var state = getState(txtZip.value); for (var i = 0; i < optionBox.options.length; i++) if (optionBox.options[i].value == state) return optionBox.options[i].selected = true; for (var i = 0; i < optionBox.options.length; i++) if (optionBox.options[i].value == "XX") return optionBox.options[i].selected = true; }

    Read the article

  • Howto: Access a second related model in a nested attribute builder block

    - by Joe Cairns
    I have a basic has_many through relationship: class Foo < ActiveRecord::Base has_many :bars, :dependent => :destroy has_many :wtfs :through => :bars accepts_nested_attributes_for :bars, :wtfs end On my crud forms I have a builder block for the wtf, but I need the label to come from the bar (an attribute called label for instance). What's the proper method to do this? Here's the most simple scaffold: <h1>New foo</h1> <% form_for(@foo) do |f| %> <%= f.error_messages %> <p> <%= f.label :name %><br /> <%= f.text_field :name %> </p> <h2>Bars</h2> <% f.fields_for :wtfs do |builder| %> <%= builder.hidden_field :bar_id %> <p> <%= builder.text_field :wtf_data_i_need_to_set %> </p> <% end %> <p> <%= f.submit 'Create' %> </p> <% end %> <%= link_to 'Back', foos_path %>

    Read the article

  • How do I keep users from spoofing data through a form?

    - by Jonathan
    I have a site which has been running for some time now that uses a great deal of user input to build the site. Naturally there are dozens of forms on the site. When building the site, I often used hidden form fields to pass data back to the server so that I know which record to update. an example might be: <input type="hidden" name="id" value="132" /> <input type="text" name="total_price" value="15.02" /> When the form is submitted, these values get passed to the server and I update the records based on the data passed (i.e. the price of record 132 would get changed to 15.02). I recently found out that you can change the attributes and values via something as simple as firebug. So...I open firebug and change the id value to "155" and the price value to "0.00" and then submit the form. Viola! I view product number 155 on the site and it now says that it's $0.00. This concerns me. How can I know which record to update without either a query string (easily modified) or a hidden input element passing the id to the server? And if there's no better way (I've seen literally thousands of websites that pass the data this way), then how would I make it so that if a user changes these values, the data on the server side is not executed (or something similar to solve the issue)? I've thought about encrypting the id and then decrypting it on the other side, but that still doesn't protect me from someone changing it and just happening to get something that matches another id in the database. I've also thought about cookies, but I've heard that those can be manipulated as well. Any ideas? This seems like a HUGE security risk to me.

    Read the article

  • winUserControl in VS2010 - properties are not visible in designer

    - by mj82
    I have a problem with (I suppose) my Visual Studio 2010 Express environment: when I design my own UserControl, in Properties grid I can't see public properties of that control. They are however visible in the project, that reference this control. As it's Express Edition, I create new empty project, then add new UserControl to it. Then, for a test, I put following code: using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; namespace Project1 { public partial class UserControl1 : UserControl { private int myNumber; [Browsable(true)] public int MyNumber { get { return myNumber; } set { myNumber = value; } } public UserControl1() { InitializeComponent(); } } } In VS 2008, as I remember, that should be enogh to show MyNumber property in Properties grid, even without [Browsable(true)] attribute. In VS 2010 however, when I double click UserControl1.cs in Solution Explorer and look in Properties, I don't see MyNumber. When I reference and use this control in another project, there is an access to it's properties. I've tried to competly reinstall VS 2010 environment, including SP1, but with no success. Do you have any idea what can be wrong? By the way: none of these attributes are working, either: [Browsable(true)] [EditorBrowsable(EditorBrowsableState.Always)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] [Bindable(true)] Best regards, Marcin

    Read the article

  • FormStartPosition.CenterParent does not work

    - by kol
    In the following code, only the second method works for me (.NET 4.0). FormStartPosition.CenterParent does not center the child form over its parent. Why? Source: this SO question using System; using System.Drawing; using System.Windows.Forms; class Program { private static Form f1; public static void Main() { f1 = new Form() { Width = 640, Height = 480 }; f1.MouseClick += f1_MouseClick; Application.Run(f1); } static void f1_MouseClick(object sender, MouseEventArgs e) { Form f2 = new Form() { Width = 400, Height = 300 }; switch (e.Button) { case MouseButtons.Left: { // 1st method f2.StartPosition = FormStartPosition.CenterParent; break; } case MouseButtons.Right: { // 2nd method f2.StartPosition = FormStartPosition.Manual; f2.Location = new Point( f1.Location.X + (f1.Width - f2.Width) / 2, f1.Location.Y + (f1.Height - f2.Height) / 2 ); break; } } f2.Show(f1); } }

    Read the article

  • PHP Form multiple buttons

    - by Ken
    I have a form with 2 buttons, that depending on which is selected will either be deleted or edited from the database. Those are each individual pages using SQL statements (questionedit and questiondelete). However, when i press a button, nothing happens...Any Ideas Here is my javascript <script type="text/javascript"> function SelectedButton(button) { if(button == 'edit') { document.testedit_questionform.action ="testedit_questionedit.php"; } else if(button == 'delete') { document.testedit_questionform.action ="testedit_questiondelete.php"; } document.forms[].testedit_questionform.submit(); } </script> Here is my form (being echoed from a loop) <form name=\"testedit_questionform\" action=\"SelectedButton\" method=\"POST\"> <span class=\"grid_11 prefix_1\" id=\"\" > Question:<input type=\"text\" name=\"QuestionText\" style=\"width:588px; margin-left:10px;\" value=\"$row[0]\"/> <input type=\"button\" value=\"Edit\" name=\"Operation\"onclick=\"submitForm(\'edit\')\" /> <input type=\"button\" value=\"Delete\" name=\"Operation\"onclick=\"submitForm(\'delete\')\" /> <input type=\"hidden\" name=\"QId\" value=\"$row[3]\" /><br />"); </form>

    Read the article

  • multiple form submission with one submit

    - by skylab
    I've been trying to think this through and figure out if it is possible or not. I'm using zen-cart as shopping cart software, but what I'd like to do, is hard code a page that is basically a list of 7-9 products, next to each product is a checkbox, so I'd like to figure out a way, via html,javascript or jquery to submit whichever forms(products) are checked to the cart. The typical form submission for a product looks something like this(sometimes there may be one or two additional hidden fields): <form name="cart_quantity" action="index.php?action=add_product" method="post" enctype="multipart/form-data"> <input type="hidden" name="cart_quantity" value="1"> <input type="hidden" name="products_id" value="7"> <input type="hidden" name="id[6]" value="9" id="attrib-6-9"> <input type="image" src="buy_button.png" alt="Add to Cart" title="Instructional Video Part 1: Add to Cart"> </form> There would be 7-9 of these on the page, each with a checkbox, so I'm assuming a script would need to figure out which ones where checked and submit them via the form action? Maybe there is a better way of going about this that I'm not thinking of because a)it's over my head or b)just haven't figured it out yet. Anyway is something like this possible?

    Read the article

  • Difficulty Inserting from HTML form into MySQL (created in Workbench)

    - by Chaya Cooper
    I created a MySQL database in Workbench 5.2.35 for purposes of storing and using information submitted in html forms but I'm having difficulty inserting records from the html form. The relevant SQL script was saved as Demo2.sql, the schema is C2F, and the table is customer_info. I wasn't sure if that was the problem, so I tried replacing the database name (Demo2) with the schema name, but that didn't work either. My html file includes: form action="insert.php" method="post" The insert.php file states: ?php $con = mysql_connect("localhost","root","****"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("Demo2", $con); $sql="INSERT INTO customer_info(fname, lname, user, password, reminder, answer) VALUES ('$_POST[fname]','$_POST[lname]','$_POST[user]','$_POST[password]','$_POST[reminder]','$_POST[answer]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "1 record added"; mysql_close($con) ? I've also tried INSERT INTO c2f.customer_info(fname, lname, etc. and INSERT INTO 'c2f'.'customer_info'

    Read the article

  • Making IE "forget" information entered in form when using back button.

    - by typoknig
    I have a page with a form where many of the fields are populated from variables passed in the URL. Those fields are disabled (NON-EDITABLE) and are only there for the user to view. The remaining fields require user input and are NOT disabled (EDITABLE). When the form is submitted a confirmation page comes up. It may be the case that the user needs to submit several of these forms where the NON-EDITABLE information is identical from form to form, so being able to go back to the form page from the confirmation page would save a lot of time. The way I want this to work is when a user presses the back button all the NON-EDITABLE fields are populated, but the EDITABLE fields are blank. This is what Firefox is doing, but IE8 is does not "forget" what has been entered in the EDITABLE fields. To disable the cache the following appears at the beginning of my page AND at the end of my page. <head> <meta http-equiv="Pragma" content="no-cache"/> <meta http-equiv="Cache-Control" content="no-store"/> <head/> What more must I do to make IE forget what was entered in the EDITABLE fields when the back button is pressed? All of my pages are generated with PHP if that matters. EDIT: It appears to me that this is a problem of IE caching my page even though I have told it not to. Are my meta tags correct? Do I need to do something else to prevent IE from caching my page?

    Read the article

  • Rails form not creating object

    - by user2136807
    I have created a simple form to create an instance of a modle and for some reason it is not calling the create method in the controller. Here is the form code: <% @house.mates.each do |mate| %> <p><%= mate.name %></p> <% end %> <h2>Add a new mate:</h2> <%= form_for @mate do |f| %> <p><%= f.label "Name" %> <%= f.text_field :name %> <%= f.hidden_field :house_id %> </p> <%= f.submit "Submit", :action => :create %> <% end %> Here is the controller code: class MatesController < ApplicationController def new @mate = Mate.new end def create @mate = Mate.new(params[:mate]) @mate.save redirect_to house_path(current_house) end end There is a many to one relationship between the Mate model and the House model... I am fairly new to rails but I have made other apps with similar forms, and I have never had this problem before. I can create and save Mate objects in the console, and I am not getting any errors, so it seem that somehow the controller method is not being called. Any help is much appreciated!

    Read the article

  • Speech recognition plugin Runtime Error: Unhandled Exception. What could possibly cause it?

    - by manuel
    I'm writing a plugin (dll file) for speech recognition, and I'm creating a WinForm as its interface/dialog. When I run the plugin and click a button to start the initialization, I get an unhandled exception. Below is the complete details of it. See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box. ***** Exception Text ******* System.ArgumentException: Value does not fall within the expected range. at System.Speech.Internal.SapiInterop.SapiProxy.MTAThread.Invoke2(VoidDelegate pfn) at System.Speech.Internal.SapiInterop.SapiRecognizer.SetInput(Object input, Boolean allowFormatChanges) at System.Speech.Recognition.RecognizerBase.SetInputToDefaultAudioDevice() at System.Speech.Recognition.SpeechRecognitionEngine.SetInputToDefaultAudioDevice() at gen_myplugin.Dialog.init() at gen_myplugin.Dialog.btnSpeak_Click(Object sender, EventArgs e) at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) ***** Loaded Assemblies ******* mscorlib Assembly Version: 2.0.0.0 Win32 Version: 2.0.50727.3603 (GDR.050727-3600) CodeBase: file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll ---------------------------------------- gen_speechquery Assembly Version: 1.0.3755.878 Win32 Version: CodeBase: file:///C:/Program%20Files/Winamp/Plugins/gen_speechquery.dll ---------------------------------------- msvcm90 Assembly Version: 9.0.30729.1 Win32 Version: 9.00.30729.1 CodeBase: file:///C:/WINDOWS/WinSxS/x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.30729.1_x-ww_6f74963e/msvcm90.dll ---------------------------------------- System.Windows.Forms Assembly Version: 2.0.0.0 Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000) CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll ---------------------------------------- System Assembly Version: 2.0.0.0 Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000) CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll ---------------------------------------- System.Drawing Assembly Version: 2.0.0.0 Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000) CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll ---------------------------------------- System.Speech Assembly Version: 3.0.0.0 Win32 Version: 3.0.6920.1109 (lh_tools_devdiv_wpf.071009-1109) CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Speech/3.0.0.0__31bf3856ad364e35/System.Speech.dll ***** JIT Debugging ******* To enable just-in-time (JIT) debugging, the .config file for this application or computer (machine.config) must have the jitDebugging value set in the system.windows.forms section. The application must also be compiled with debugging enabled. For example: When JIT debugging is enabled, any unhandled exception will be sent to the JIT debugger registered on the computer rather than be handled by this dialog box.

    Read the article

  • Winforms connection strings from App.config

    - by Geo Ego
    I have a Winforms app that I am developing in C# that will serve as a frontend for a SQL Server 2005 database. I rolled the executable out to a test machine and ran it. It worked perfectly fine on the test machine up until the last round of changes that I made. However, now on the test machine, it throws the following exception immediately upon opening: System.NullReferenceException: Object reference not set to an instance of an object. at PSRD_Specs_Database_Administrat.mainMenu.mainMenu_Load(Object sender, EventArgs e) at System.Windows.Forms.Form.OnLoad(EventArgs e) at System.Windows.Forms.Form.OnCreateControl() at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible) at System.Windows.Forms.Control.CreateControl() at System.Windows.Forms.Control.WmShowWindow(Message& m) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ScrollableControl.WndProc(Message& m) at System.Windows.Forms.ContainerControl.WndProc(Message& m) at System.Windows.Forms.Form.WmShowWindow(Message& m) at System.Windows.Forms.Form.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) The only thing that I changed in this version that pertains to mainMenu_Load is the way that the connection string to the database is called. Previously, I had set a string with the connection string on every form that I needed to call it from, like: string conString = "Data Source = SHAREPOINT;Trusted_Connection = yes;" + "database = CustomerDatabase;connection timeout = 15"; As my app grew and I added forms to it, I decided to add an App.config to the project. I defined the connection string in it: <connectionStrings> <add name="conString" providerName="System.Data.SqlClient" connectionString="Data Source = SHAREPOINT;Trusted_Connection = yes;database = CustomerDatabase;connection timeout = 15" /> </connectionStrings> I then created a static string that would return the conString: public static string GetConnectionString(string conName) { string strReturn = string.Empty; if (!(string.IsNullOrEmpty(conName))) { strReturn = ConfigurationManager.ConnectionStrings[conName].ConnectionString; } else { strReturn = ConfigurationManager.ConnectionStrings["conString"].ConnectionString; } return strReturn; } I removed the conString variable and now call the connection string like so: PublicMethods.GetConnectionString("conString").ToString() It appears that this is giving me the error. I changed these instances to directly call the connection string from App.config without using GetConnectionString. For instance, in a SQLConnection: using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["conString"].ConnectionString)) This also threw the exception. However, when I went back to using the conString variable on each form, I had no issues. What I don't understand is why all three methods work fine on my development machine, while using the App.config directly or via the static string I created throw exceptions.

    Read the article

  • What are the names for various forms of camel-case style naming?

    - by Robert Dailey
    For the purposes of communicating coding styles to my co-workers, what would I formally call the following variants of camel case? camelCase and CamelCase Notice that the former version starts with a lower-case alphabetic character, and the latter version starts with an upper-case alphabetic character. I assume these have some sort of "official name". Also if there are any other forms I have not listed here, bonus points to those that mention them as well as well as their names.

    Read the article

  • Django Formset management-form validation error

    - by gramware
    I have a form and a formset on my template. The problem is that the formset is throwing validation error claiming that the management form is "missing or has been tampered with". Here is my view @login_required def home(request): user = UserProfile.objects.get(pk=request.session['_auth_user_id']) blogz = list(blog.objects.filter(deleted='0')) delblog = modelformset_factory(blog, exclude=('poster','date' ,'title','content')) if request.user.is_staff== True: staff = 1 else: staff = 0 staffis = 1 if request.method == 'POST': delblogformset = delblog(request.POST) if delblogformset.is_valid(): delblogformset.save() return HttpResponseRedirect('/home') else: delblogformset = delblog(queryset=blog.objects.filter( deleted='0')) blogform = BlogForm(request.POST) if blogform.is_valid(): blogform.save() return HttpResponseRedirect('/home') else: blogform = BlogForm(initial = {'poster':user.id}) blogs= zip(blogz,delblogformset.forms) paginator = Paginator(blogs, 10) # Show 25 contacts per page # Make sure page request is an int. If not, deliver first page. try: page = int(request.GET.get('page', '1')) except ValueError: page = 1 # If page request (9999) is out of range, deliver last page of results. try: blogs = paginator.page(page) except (EmptyPage, InvalidPage): blogs = paginator.page(paginator.num_pages) return render_to_response('home.html', {'user':user, 'blogform':blogform, 'staff': staff, 'staffis': staffis, 'blog':blogs, 'delblog':delblogformset}, context_instance = RequestContext( request )) my template {%block content%} <h2>Home</h2> {% ifequal staff staffis %} {% if form.errors %} <ul> {% for field in form %} <H3 class="title"> <p class="error"> {% if field.errors %}<li>{{ field.errors|striptags }}</li>{% endif %}</p> </H3> {% endfor %} </ul> {% endif %} <h3>Post a Blog to the Front Page</h3> <form method="post" id="form2" action="" class="infotabs accfrm"> {{ blogform.as_p }} <input type="submit" value="Submit" /> </form> <br> <br> {% endifequal %} <div class="pagination"> <span class="step-links"> {% if blog.has_previous %} <a href="?page={{ blog.previous_page_number }}">previous</a> {% endif %} <span class="current"> Page {{ blog.number }} of {{ blog.paginator.num_pages }}. </span> {% if blog.has_next %} <a href="?page={{ blog.next_page_number }}">next</a> {% endif %} </span> <form method="post" action="" class="usertabs accfrm"> {{delblog.management_form}} {% for b, form in blog.object_list %} <div class="blog"> <h3>{{b.title}}</h3> <p>{{b.content}}</p> <p>posted by <strong>{{b.poster}}</strong> on {{b.date}}</p> {% ifequal staff staffis %}<p>{{form.as_p}}<input type="submit" value="Delete" /></p>{% endifequal %} </div> {% endfor %} </form> {%endblock%}

    Read the article

  • Rails - embedded polymorphic comment list + add comment form - example?

    - by odigity
    Hey, all. Working on my first Rails app. I've searched all around - read a bunch of tutorials, articles, and forum posts, watched some screencasts, and I've found a few examples that come close to what I'm trying to do (notably http://railscasts.com/episodes/154-polymorphic-association and ep 196 about nested model forms), but not exactly. I have two models (Podcast and BlogPost) that need to be commentable, and I have a Comment model that is polymorphically related to both. The railscasts above had a very similar example (ep 154), but Ryan used a full set of nested routes, so there were specific templates for adding and editing comments. What I want to do is show the list of comments right on the Podcast or BlogPost page, along with an Add Comment form at the bottom. I don't need a separate add template/route, and I don't need the ability to edit, only delete. This is a pretty common design on the web, but I can't find a Rails example specifically about this pattern. Here's my current understanding: I need routes for the create and delete actions, of course, but there are no templates associated with those. I'm also guessing that the right approach is to create a partial that can be included at the bottom of both the Podcast and BlogPost show template. The logical name for the partial seems to me to be something like _comments.html.haml. I know it's a common convention to have the object passed to the partial be named after the template, but calling the object 'comments' seems to not match my use case, since what I really need to pass is the commentable object (Podcast or BlogPost). So, I guess I'd use the locals option for the render partial call? (:commentable = @podcast). Inside the partial, I could call commentable.comments to get the comments collection, render that with a second partial (this time with the conventional use case, calling the partial _comment.html.haml), then create a form that submits to... what? REST-wise, it should be a POST to the collection, which would be /podcast|blogpost/:id/comments, and I think the helper for that is podcast_comments_path(podcast) if it were a podcast - not sure what to do though, since I'm using polymorphic comments. That would trigger the Comment.create action, which would then need to redirect back to the podcast|blogpost path /podcast|blogpost/:id. It's all a bit overwhelming, which is why I was really hoping to find a screencast or example that specifically implements this design.

    Read the article

  • SharePoint 2010 Custom WCF Service - Windows and FBA Authentication

    - by e-rock
    I have SharePoint 2010 configured for Claims Based Authentication with both Windows and Forms Based Authentication (FBA) for external users. I also need to develop custom WCF Services. The issue is that I want Windows credentials passed into the WCF Service(s); however, I cannot seem to get the Windows credentials passed into the services. My custom WCF service appears to be using Anonymous authentication (which has to be enabled in IIS in order to display the FBA login screen). The example I have tried to follow is found at http://msdn.microsoft.com/en-us/library/ff521581.aspx. The WCF service gets deployed to _vti_bin (ISAPI folder). Here is the code for the .svc file <%@ ServiceHost Language="C#" Debug="true" Service="MyCompany.CustomerPortal.SharePoint.UI.ISAPI.MyCompany.Services.LibraryManagers.LibraryUploader, $SharePoint.Project.AssemblyFullName$" Factory="Microsoft.SharePoint.Client.Services.MultipleBaseAddressBasicHttpBindingServiceHostFactory, Microsoft.SharePoint.Client.ServerRuntime, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" CodeBehind="LibraryUploader.svc.cs" %> Here is the code behind for the .svc file [ServiceContract] public interface ILibraryUploader { [OperationContract] string SiteName(); } [BasicHttpBindingServiceMetadataExchangeEndpoint] [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)] public class LibraryUploader : ILibraryUploader { //just try to return site title right now… public string SiteName() { WindowsIdentity identity = ServiceSecurityContext.Current.WindowsIdentity; ClaimsIdentity claimsIdentity = new ClaimsIdentity(identity); return SPContext.Current.Web.Title; } } The WCF test client I have just to test it out (WPF app) uses the following code to call the WCF service... private void Button1Click(object sender, RoutedEventArgs e) { BasicHttpBinding binding = new BasicHttpBinding(); binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly; binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm; EndpointAddress endpoint = new EndpointAddress( "http://dev.portal.data-image.local/_vti_bin/MyCompany.Services/LibraryManagers/LibraryUploader.svc"); LibraryUploaderClient libraryUploader = new LibraryUploaderClient(binding, endpoint); libraryUploader.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation; MessageBox.Show(libraryUploader.SiteName()); } I am somewhat inexperienced with IIS security settings/configurations when it comes to Claims and trying to use both Windows and FBA. I am also inexperienced when it comes to WCF configurations for security. I usually develop internal biz apps and let Visual Studio decide what to use because security is rarely a concern.

    Read the article

  • Continuous Form, how to add/update records with external connection

    - by Mohgeroth
    EDIT After some more research I found that I cannot use a continuous form with an unbound form since it can only reference a single record at a time. Given that I've altered my question... I have a sample form that pulls out data to enter into a table as an intermediary. Initially the form is unbound and I open connections to two main recordsets. I set the listbox's recordset equal to one of them and the forms recordset equal to the other. The problem is that I cannot add records or update existing ones. Attempting to key into the fields does nothing almost as if the field was locked (Which it is not). Settings of the recordsets are OpenKeyset and LockPessimistic. Tables are not linked, they come from an outside access database seperate from this project and must remain that way. I am using an adodb connection to get the data. Could the separation of the data from the project be causing this? Sample Code from the Form Option Compare Database Option Explicit Private conn As CRobbers_Connections Private exception As CError_Trapping Private mClient_Translations As ADODB.Recordset Private mUnmatched_Clients As ADODB.Recordset Private mExcluded_Clients As ADODB.Recordset //Construction Private Sub Form_Open(Cancel As Integer) Set conn = New CRobbers_Connections Set exception = New CError_Trapping Set mClient_Translations = New ADODB.Recordset Set mUnmatched_Clients = New ADODB.Recordset Set mExcluded_Clients = New ADODB.Recordset mClient_Translations.Open "SELECT * FROM Client_Translation" _ , conn.RBRS_Conn, adOpenKeyset, adLockPessimistic mUnmatched_Clients.Open "SELECT DISTINCT(a.Client) as Client" _ & " FROM Master_Projections a " _ & " WHERE Client NOT IN ( " _ & " SELECT DISTINCT ClientID " _ & " FROM Client_Translation);" _ , conn.RBRS_Conn, adOpenKeyset, adLockPessimistic mExcluded_Clients.Open "SELECT * FROM Clients_Excluded" _ , conn.RBRS_Conn, adOpenKeyset, adLockPessimistic End Sub //Add new record to the client translations Private Sub cmdAddNew_Click() If lstUnconfirmed <> "" Then AddRecord End If End Sub Private Function AddRecord() With mClient_Translations .AddNew .Fields("ClientID") = Me.lstUnconfirmed .Fields("ClientAbbr") = Me.txtTmpShort .Fields("ClientName") = Me.txtTmpLong .Update End With UpdateRecords End Function Private Function UpdateRecords() Me.lstUnconfirmed.Requery End Function //Load events (After construction) Private Sub Form_Load() Set lstUnconfirmed.Recordset = mUnmatched_Clients //Link recordset into listbox Set Me.Recordset = mClient_Translations End Sub //Destruction method Private Sub Form_Close() Set conn = Nothing Set exception = Nothing Set lstUnconfirmed.Recordset = Nothing Set Me.Recordset = Nothing Set mUnmatched_Clients = Nothing Set mExcluded_Clients = Nothing Set mClient_Translations = Nothing End Sub

    Read the article

  • expand div with focus-jquery

    - by Joel
    Hi guys, I'm revisiting this after a few weeks, because I could never get it to work before, and hoping to now. Please look at this website-notice the newsletter signup form at the top right. http://www.rattletree.com I am wanting it to look exactly this way for now, but when the user clicks in the box to enter their email address, the containing div will expand (or simply appear) above the email field to also include a "name" and "city" field. I'm using jquery liberally in the sight, so that is at my disposal. This form is in the header so any id info, etc can't be withing the body tag... This is what I have so far: <div class="outeremailcontainer"> <div id="emailcontainer"> <?php include('verify.php'); ?> <form action="index_success.php" method="post" id="sendEmail" class="email"> <h3 class="register2">Newsletter Signup:</h3> <ul class="forms email"> <li class="email"><label for="emailFrom">Email: </label> <input type="text" name="emailFrom" class="info" id="emailFrom" value="<?= $_POST['emailFrom']; ?>" /> <?php if(isset($emailFromError)) echo '<span class="error">'.$emailFromError.'</span>'; ?> </li> <li class="buttons email"> <button type="submit" id="submit">Send</button> <input type="hidden" name="submitted" id="submitted" value="true" /> </li> </ul> </form> <div class="clearing"> </div> </div> css: p.emailbox{ text-align:center; margin:0; } p.emailbox:first-letter { font-size: 120%; font-weight: bold; } .outeremailcontainer { height:60px; width: 275px; background-image:url(/images/feather_email2.jpg); /*background-color:#fff;*/ text-align:center; /* margin:-50px 281px 0 auto ; */ float:right; position:relative; z-index:1; } form.email{ position:relative; } #emailcontainer { margin:0; padding: 0 auto; z-index:1000; display:block; position:relative; } Thanks for any help! Joel

    Read the article

  • ASP.NET MVC 4/Web API Single Page App for Mobile Devices ... Needs Authentication

    - by lmttag
    We have developed an ASP.NET MVC 4/Web API single page, mobile website (also using jQuery Mobile) that is intended to be accessed only from mobile devices (e.g., iPads, iPhones, Android tables and phones, etc.), not desktop browsers. This mobile website will be hosted internally, like an intranet site. However, since we’re accessing it from mobile devices, we can’t use Windows authentication. We still need to know which user (and their role) is logging in to the mobile website app. We tried simply using ASP.NET’s forms authentication and membership provider, but couldn’t get it working exactly the way we wanted. What we need is for the user to be prompted for a user name and password only on the first time they access the site on their mobile device. After they enter a correct user name and password and have been authenticated once, each subsequent time they access the site they should just go right in. They shouldn’t have to re-enter their credentials (i.e., something needs to be saved locally to each device to identify the user after the first time). This is where we had troubles. Everything worked as expected the first time. That is, the user was prompted to enter a user name and password, and, after doing that, was authenticated and allowed into the site. The problem is every time after the browser was closed on the mobile device, the device and user were not know and the user had to re-enter user name and password. We tried lots of things too. We tried setting persistent cookies in JavaScript. No good. The cookies weren’t there to be read the second time. We tried manually setting persistent cookies from ASP.NET. No good. We, of course, used FormsAuthentication.SetAuthCookie(model.UserName, true); as part of the form authentication framework. No good. We tried using HTML5 local storage. No good. No matter what we tried, if the user was on a mobile device, they would have to log in every single time. (Note: we’ve tried on an iPad and iPhone running both iOS 5.1 and 6.0, with Safari configure to allow cookies, and we’ve tried on Android 2.3.4.) Is there some trick to getting a scenario like this working? Or, do we have to write some sort of custom authentication mechanism? If so, how? And, what? Or, should we use something like claims-based authentication and WIF? Or??? Any help is appreciated. Thanks!

    Read the article

  • Showing div based on filled form field

    - by Fabio
    I have this script where I use a slider to show some elements of a form. So far so good. The way I'm doing it is by having a slider (can't use a multistep form since it uses a plugin not allowing multistep forms, plus some graphic behaviors) and a button that goes to the next slider. So now I need that button (not part of the form) to show only if a certain field is filled. I tried teh following, but it's not working, I assume some error but can't figure what. My code is as follows: $('#clientname').change(function() { var clientVal = $("input").val() == ''; $(".next").hide(); if ($('#clientname').val() != '').show(); else $('.next').hide(); }); and the html as follows: <div class="b40-right"> <h3>The Basics</h3> <div class="label"> Your Name (required)</div> <div class="inputes"> <span class="wpcf7-form-control-wrap your-name"><input id="clientname" type="text" name="your-name" value="" class="wpcf7-form-control wpcf7-text wpcf7-validates-as-required" size="40" /></span> </div> <div class="label">Your Email (required)</div> <div class="inputes"> <span class="wpcf7-form-control-wrap your-email"><input type="text" name="your-email" value="" class="wpcf7-form-control wpcf7-text wpcf7-email wpcf7-validates-as-required wpcf7-validates-as-email" size="40" /></span> </div> <div class="label">Type of Business</div> <div class="inputes"> <span class="wpcf7-form-control-wrap type-of-business"><textarea name="type-of-business" class="wpcf7-form-control wpcf7-textarea" cols="40" rows="10"></textarea></span> </div> </div> <a class="next" href="javascript:stepcarousel.stepBy('mygallery2', 1)"><img id="nextbut1" src="<?php bloginfo('template_directory'); ?>/images/next.png" alt="" /></a> any help on what am I doing wrong? Is there a better approach/solution? (I'm not a programmer as you may figure) Thank you in advance!

    Read the article

  • Form value field is visable in localhost but not on live site-how to hide?

    - by Joel
    Hi guys, I'm almost completed moving my first live site to my new xampp setup on localhost. I have a form that uses jquery in the header of the site. It's a bit verbose, but here it is: <div class="outeremailcontainer"> <div id="emailcontainer"> <?php include('verify.php'); ?> <form action="index_success.php" method="post" id="sendEmail" class="email"> <h3 class="register2">Newsletter Signup:</h3> <ul class="forms email"> <li class="name"><label for="yourName">Name: </label> <input type="text" name="yourName" class="info" id="yourName" value="<?= $_POST['yourName']; ?>" /><br /> </li> <li class="city"><label for="yourCity">City: </label> <input type="text" name="yourCity" class="info" id="yourCity" value="<?= $_POST['yourCity']; ?>" /><br /> </li> <li class="email"><label for="emailFrom">Email: </label> <input type="text" name="emailFrom" class="info" id="emailFrom" value="<?= $_POST['emailFrom']; ?>" /> <?php if(isset($emailFromError)) echo '<span class="error">'.$emailFromError.'</span>'; ?> </li> <li class="buttons email"> <button type="submit" id="submit">Send</button> <input type="hidden" name="submitted" id="submitted" value="true" /> </li> </ul> </form> <div class="clearing"> </div> </div> </div> So I am using jQuery (I can include the function if need-be) and it hides fields, etc. The problem is that on the localhost site, the values of the fields are populating the fields. IE: first field has this in the box, etc <?= $_POST['yourName']; ?> It works great in the live site though. Any idea how to fix this? Thanks!

    Read the article

  • How to use jQuery to generate 2 new associated objects in a nested form?

    - by mind.blank
    I have a model called Pair, which has_many :questions, and each Question has_one :answer. I've been following this railscast on creating nested forms, however I want to generate both a Question field and it's Answer field when clicking on an "Add Question" link. After following the railscast this is what I have: ..javascripts/common.js.coffee: window.remove_fields = (link)-> $(link).closest(".question_remove").remove() window.add_fields = (link, association, content)-> new_id = new Date().getTime() regexp = new RegExp("new_" + association, "g") $(link).before(content.replace(regexp, new_id)) application_helper.rb: def link_to_add_fields(name, f, association) new_object = f.object.class.reflect_on_association(association).klass.new fields = f.simple_fields_for(association, new_object, :child_index => "new_#{association}") do |builder| render(association.to_s.singularize + "_fields", :f => builder) end link_to_function(name, "window.add_fields(this, \"#{association}\", \"#{escape_javascript(fields)}\")", class: "btn btn-inverse") end views/pairs/_form.html.erb: <%= simple_form_for(@pair) do |f| %> <div class="row"> <div class="well span4"> <%= f.input :sys_heading, label: "System Heading", placeholder: "required", input_html: { class: "span4" } %> <%= f.input :heading, label: "User Heading", input_html: { class: "span4" } %> <%= f.input :instructions, as: :text, input_html: { class: "span4 input_text" } %> </div> </div> <%= f.simple_fields_for :questions do |builder| %> <%= render 'question_fields', f: builder %> <% end %> <%= link_to_add_fields "<i class='icon-plus icon-white'></i> Add Another Question".html_safe, f, :questions %> <%= f.button :submit, "Save Pair", class: "btn btn-success" %> <% end %> _question_fields.html.erb partial: <div class="question_remove"> <div class="row"> <div class="well span4"> <%= f.input :text, label: "Question", input_html: { class: "span4" }, placeholder: "your question...?" %> <%= f.simple_fields_for :answer do |builder| %> <%= render 'answer_fields', f: builder %> <% end %> </div> </div> </div> _answer_fields.html.erb partial: <%= f.input :text, label: "Answer", input_html: { class: "span4" }, placeholder: "your answer" %> <%= link_to_function "remove", "remove_fields(this)", class: "float-right" %> I'm especially confused by the reflect_on_association part, for example how does calling .new there create an association? I usually need to use .build Also for a has_one I use .build_answer rather than answers.build - so what does this mean for the jQuery part?

    Read the article

  • ASP.net roles and Projects

    - by Zyphrax
    EDIT - Rewrote my original question to give a bit more information Background info At my work I'm working on a ASP.Net web application for our customers. In our implementation we use technologies like Forms authentication with MembershipProviders and RoleProviders. All went well until I ran into some difficulties with configuring the roles, because the roles aren't system-wide, but related to the customer accounts and projects. I can't name our exact setup/formula, because I think our company wouldn't approve that... What's a customer / project? Our company provides management information for our customers on a yearly (or other interval) basis. In our systems a customer/contract consists of: one Account: information about the Company per Account, one or more Products: the bundle of management information we'll provide per Product, one or more Measurements: a period of time, in which we gather and report the data Extranet site setup Eventually we want all customers to be able to access their management information with our online system. The extranet consists of two sites: Company site: provides an overview of Account information and the Products Measurement site: after selecting a Measurement, detailed information on that period of time The measurement site is the most interesting part of the extranet. We will create submodules for new overviews, reports, managing and maintaining resources that are important for the research. Our Visual Studio solution consists of a number of projects. One web application named Portal for the basis. The sites and modules are virtual directories within that application (makes it easier to share MasterPages among things). What kind of roles? The following users (read: roles) will be using the system: Admins: development users :) (not customer related, full access) Employees: employees of our company (not customer related, full access) Customer SuperUser: top level managers (full access to their account/measurement) Customer ContactPerson: primary contact (full access to their measurement(s)) Customer Manager: a department manager (limited access, specific data of a measurement) What about ASP.Net users? The system will have many ASP.Net users, let's focus on the customer users: Users are not shared between Accounts SuperUser X automatically has access to all (and new) measurements User Y could be Primary contact for Measurement 1, but have no role for Measurement 2 User Y could be Primary contact for Measurement 1, but have a Manager role for Measurement 2 The department managers are many individual users (per Measurement), if Manager Z had a login for Measurement 1, we would like to use that login again if he participates in Measurement 2. URL structure These are typical urls in our application: http://host/login - the login screen http://host/project - the account/product overview screen (measurement selection) http://host/project/1000 - measurement (id:1000) details http://host/project/1000/planning - planning overview (for primary contact/superuser) http://host/project/1000/reports - report downloads (manager department X can only access report X) We will also create a document url, where you can request a specific document by it's GUID. The system will have to check if the user has rights to the document. The document is related to a Measurement, the User or specific roles have specific rights to the document. What's the problem? (finally ;)) Roles aren't enough to determine what a user is allowed to see/access/download a specific item. It's not enough to say that a certain navigation item is accessible to Managers. When the user requests Measurement 1000, we have to check that the user not only has a Manager role, but a Manager role for Measurement 1000. Summarized: How can we limit users to their accounts/measurements? (remember superusers see all measurements, some managers only specific measurements) How can we apply roles at a product/measurement level? (user X could be primarycontact for measurement 1, but just a manager for measurement 2) How can we limit manager access to the reports screen and only to their department's reports? All with the magic of asp.net classes, perhaps with a custom roleprovider implementation. Similar Stackoverflow question/problem http://stackoverflow.com/questions/1367483/asp-net-how-to-manage-users-with-different-types-of-roles

    Read the article

  • Possible bug in ASP.NET MVC with form values being replaced.

    - by Dan Atkinson
    I appear to be having a problem with ASP.NET MVC in that, if I have more than one form on a page which uses the same name in each one, but as different types (radio/hidden/etc), then, when the first form posts (I choose the 'Date' radio button for instance), if the form is re-rendered (say as part of the results page), I seem to have the issue that the hidden value of the SearchType on the other forms is changed to the last radio button value (in this case, SearchType.Name). Below is an example form for reduction purposes. <% Html.BeginForm("Search", "Search", FormMethod.Post); %> <%= Html.RadioButton("SearchType", SearchType.Date, true) %> <%= Html.RadioButton("SearchType", SearchType.Name) %> <input type="submit" name="submitForm" value="Submit" /> <% Html.EndForm(); %> <% Html.BeginForm("Search", "Search", FormMethod.Post); %> <%= Html.Hidden("SearchType", SearchType.Colour) %> <input type="submit" name="submitForm" value="Submit" /> <% Html.EndForm(); %> <% Html.BeginForm("Search", "Search", FormMethod.Post); %> <%= Html.Hidden("SearchType", SearchType.Reference) %> <input type="submit" name="submitForm" value="Submit" /> <% Html.EndForm(); %> Resulting page source (this would be part of the results page) <form action="/Search/Search" method="post"> <input type="radio" name="SearchType" value="Date" /> <input type="radio" name="SearchType" value="Name" /> <input type="submit" name="submitForm" value="Submit" /> </form> <form action="/Search/Search" method="post"> <input type="hidden" name="SearchType" value="Name" /> <!-- Should be Colour --> <input type="submit" name="submitForm" value="Submit" /> </form> <form action="/Search/Search" method="post"> <input type="hidden" name="SearchType" value="Name" /> <!-- Should be Reference --> <input type="submit" name="submitForm" value="Submit" /> </form> Please can anyone else with RC1 confirm this? Maybe it's because I'm using an enum. I don't know. I should add that I can circumvent this issue by using 'manual' input () tags for the hidden fields, but if I use MVC tags (<%= Html.Hidden(...) %), .NET MVC replaces them every time. Many thanks. Update: I've seen this bug again today. It seems that this crops its head when you return a posted page and use MVC set hidden form tags with the Html helper. I've contacted Phil Haack about this, because I don't know where else to turn, and I don't believe that this should be expected behaviour as specified by David.

    Read the article

< Previous Page | 46 47 48 49 50 51 52 53 54 55 56 57  | Next Page >