Reputation: 6449
I have the following form. I would like to have the url be: http://myapp/library/#/iframe?title=Search&url=http:%2F%2Fencore.scranton.edu%2Fiii%2Fencore%2Fsearch%2F?lang=eng&target=Einstein
<form action="#/iframe?title=Search&url=http://encore.scranton.edu/iii/encore/search/" id="form" method="get" name="form" >
<input name="target" type="search" value="" placeholder="Search" class="search-input">
</form>
But instead its prepending: http://myapp/library/?target=Einstein#/iframe?title=Search&url=http:%2F%2Fencore.scranton.edu%2Fiii%2Fencore%2Fsearch%2F?lang=eng
Angular code:
iframe/templates/index.html
<div ui-view class="container">
....
<div class="animated fadeIn iframe">
<iframe src="{{ url }}" frameborder="0"></iframe>
</div>
</div>
iframe/controller.js
//
// Routes
//
.state('iframe', {
url : '/iframe?title&url',
templateUrl : 'modules/Iframe/templates/index.html',
controller : 'IframeController'
})
}]);
Upvotes: 0
Views: 55
Reputation: 1537
Without seeing the JS, I might be dancing in the dark, but did you try something like this?
Assuming no frameworks
var myform = document.getElementById("form");
var action = myform.getAttribute("action");
//reset the entire attribute
myform.setAttribute(action+"value_i_want_appended");
Upvotes: 1
Reputation: 97
Using jQuery:
var currentURL = $("#form").prop('action');
var newAction = 'http://myapp/library/' + currentURL + '&target=Einstein';
$("#form").prop('action', newAction);
Upvotes: 0
Reputation: 24561
What about this?
<form action="http://encore.scranton.edu/iii/encore/search/?title=Search" id="form" method="get" name="form" >
<input name="target" type="search" value="" placeholder="Search" class="search-input" />
<input name="title" type="hidden" value="Search" />
</form>
Upvotes: 0